Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 836
Serge Avatar asked Dec 06 '16 13:12

Serge


1 Answers

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

{     "query": {          "bool": {             "filter": [{                 "range": {                     "born": {                         "gte": "1874"                     }                 }             }]         }     } } 
like image 149
Serge Avatar answered Oct 13 '22 12:10

Serge