如何修复 ElasticSearch 'no [query] registered for [missing]'
问题:
你正在尝试运行类似这样的 ElasticSearch 查询
query-missing.json
{
"query": {
"missing" : { "field" : "myfield" }
}
}查找没有 myfield 的文档。
但是你只看到类似这样的错误消息:
elasticsearch-error.txt
elasticsearch.exceptions.RequestError: RequestError(400, 'parsing_exception', 'no [query] registered for [missing]')解决方案
正如 ElasticSearch 文档告诉我们的,没有 missing 查询!你需要改为在 must_not 子句中使用 exists 查询:
query-exists-mustnot.json
{
"query": {
"bool": {
"must_not": {
"exists": {
"field": "myfield"
}
}
}
}
}Check out similar posts by category:
Databases, ElasticSearch
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow