regex - 如何删除包含多个条件的索引?
问题描述
我尝试删除满足所选条件的指定索引。
目前我使用如下所示的一种条件删除它们
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,
}
}
}
}
你有什么想法我该怎么做?
解决方案
我想使用 bool 查询将是正确的方向,这样的事情应该可以工作:
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
}
}
]
}
}
}
推荐阅读
- django - 如何将服务器消息发送到 dropzone
- python - Numpy:将 np.vectorize 应用于具有 dtype=object 的数组
- php - 如何遍历数据库中的所有用户并应用角色
- excel - 突然 pdf 导出代码不再起作用。我的代码有问题吗?
- powershell - 使用 PowerShell 开关正则表达式解析日志文件
- vba - If/Then 语句问题
- php - 使用可扩展实体创建捆绑包
- sql - sql将两列旋转到相同的列值
- github-api - GitHub:获取某个日期范围内存储库中更改文件的计数
- amazon-web-services - 通过 PUT 请求(Amazon S3 代理)将图像文件上传到 S3 时文件损坏