Serge
Serge

Reputation: 1497

elasticsearch 5: Unknown key for a START_OBJECT in [filters]

Im trying to migrate from elasticsearch 1.7 to 5.1 and I have a problem:

curl -XGET http://127.0.0.1:9200/openlist_ru-formulars/formular/_search?pretty=true -d '{
    "filter": [
        { "range": { "born": { "gte": "1874" }}}
    ]
}'

and answer:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "parsing_exception",
        "reason" : "Unknown key for a START_OBJECT in [filters].",
        "line" : 2,
        "col" : 12
      }
    ],
    "type" : "parsing_exception",
    "reason" : "Unknown key for a START_OBJECT in [filters].",
    "line" : 2,
    "col" : 12
  },
  "status" : 400
}

I used google all the day but still have no answer what it means. Please help.

Upvotes: 27

Views: 56482

Answers (1)

Serge
Serge

Reputation: 1497

It looks like DSL structure in 5.1 version was changed and this query is good:

{
    "query": { 
        "bool": {
            "filter": [{
                "range": {
                    "born": {
                        "gte": "1874"
                    }
                }
            }]
        }
    }
}

Upvotes: 46

Related Questions