elasticsearch中查询/删除不包含某个字段的document

查询不包含某个字段的数据:

​GET /index-name/_search
{
    "query" : {
        "bool" : {
            "must_not" : {
                "exists" : {
                    "field" : "要查询的不包含的字段名"
                }
            }
        }
    }
}

根据查询结果删除不包含某个字段的数据:

POST /index-name/_delete_by_query
{
    "query" : {
        "bool" : {
            "must_not" : [
                {
                    "exists" : {
                        "field" : "字段名"
                    }
                }
            ]
        }
    }
}

猜你喜欢

转载自blog.csdn.net/QYHuiiQ/article/details/91352399
今日推荐