[英]ElasticSearch how to DELETE docs if field exists?
I want to delete all documents where a certain field exists 我想删除存在某个字段的所有文档
I tried to POST to the _delete_by_query API 我试图过帐到_delete_by_query API
{
"query": {
"bool": {
"must": [
{ "exists":"field_name" }
]
}
}
}
That's giving me this query malformed error: 这给了我这个查询格式错误:
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[exists] query malformed, no start_object after query name",
"line": 1,
"col": 37
}
],
"type": "parsing_exception",
"reason": "[exists] query malformed, no start_object after query name",
"line": 1,
"col": 37
},
"status": 400
}
How can I delete all docs if field exists? 如果字段存在,如何删除所有文档?
You do not need to wrap the exists in a bool. 您无需将存在的内容包装在布尔中。 Try this 尝试这个
{
"query": {
"exists": {
"field": "field_name"
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.