我尝试删除符合所选条件的指定索引。
此刻,我使用如下所示的一种条件删除它们
localhost:9200/pictures/picture/_delete_by_query?pretty
{
"query": {
"regexp":{
"tag": ".*something.*"
}
}
}
}
我想以此方式删除它们
localhost:9200/pictures/picture/_delete_by_query?pretty
{
"query": {
"regexp":{
"tag": ".*something.*",
"path": "this/is/my/path",
"user_id": 2,
}
}
}
}
您有任何想法该怎么做吗?
答案 0 :(得分:2)
我想使用布尔查询将是正确的方向,类似这样的方法应该起作用:
localhost:9200/pictures/picture/_delete_by_query?pretty
{
"query": {
"bool": {
"must": [
{
"regexp":{
"tag": ".*something.*",
"path": "this/is/my/path",
"user_id": 2,
}
}
},
{
"term": {
"path.keyword": "this/is/my/path"
}
},
{
"term": {
"user_id.keyword": 2
}
}
]
}
}
}