How to fix ElasticSearch 'no [query] registered for [missing]'
Problem:
You are trying to run an ElasticSearch query like
query-missing.json
{
    "query": {
        "missing" : { "field" : "myfield" }
    }
}to find documents that do not have myfield.
However you only see an error message like this:
elasticsearch-error.txt
elasticsearch.exceptions.RequestError: RequestError(400, 'parsing_exception', 'no [query] registered for [missing]')Solution
As the ElasticSearch documentation tells, us, there is no missing query! You instead need to use an exists query inside a must_not clause:
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