Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No query registered for []

I need to add missing filter to ES query bool. I tried to add directly to bool and I got no query registered for [missing]. Then I added filter and got no query registered for [filter].

I see many StackOverflow questions, and in many this works. Query example:

{
    "bool": {
        "must": [{
            "missing": {
                "field": "firstname"
            }
        }]
    }
}

ES version 1.5.2

like image 863
Squeez Avatar asked May 13 '16 19:05

Squeez


1 Answers

Looks like missing filter is being removed in elastic 5.x. I was told not to use it: https://www.elastic.co/guide/en/elasticsearch/reference/5.x/query-dsl-exists-query.html#_literal_missing_literal_query

Do this instead

GET /_search
{
    "query": {
        "bool": {
            "must_not": {
                "exists": {
                    "field": "firstname"
                }
            }
        }
    }
}
like image 70
Blake Niemyjski Avatar answered Nov 04 '22 00:11

Blake Niemyjski