Elasticsearch : query does not support [filter]];


(Dilip Dwivedi) #1

$ curl -XPOST 'localhost:9200/tindices/_search?pretty' -d '

{
"query": {
"bool": {
"must": { "match_all": {} },
"filter": {
"range": {
"balance": {
"gte": 20000,
"lte": 30000
}
}
}
}
}
}'
{
"error" : "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[gD01n50TSmSJLgTL_gPDPw][tindices][0]: SearchParseException[[tindices][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [\n{\n "query": {\n "bool": {\n "must": { "match_all": {} },\n "filter": {\n "range": {\n "balance": {\n "gte": 20000,\n "lte": 30000\n }\n }\n }\n }\n }\n}]]]; nested: QueryParsingException[[tindices] [bool] query does not support [filter]]; }{[gD01n50TSmSJLgTL_gPDPw][tindices][1]: SearchParseException[[tindices][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [\n{\n "query": {\n "bool": {\n "must": { "match_all": {} },\n "filter": {\n "range": {\n "balance": {\n "gte": 20000,\n "lte": 30000\n }\n }\n }\n }\n }\n}]]]; nested: QueryParsingException[[tindices] [bool] query does not support [filter]]; }{[gD01n50TSmSJLgTL_gPDPw][tindices][2]: SearchParseException[[tindices][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [\n{\n "query": {\n "bool": {\n "must": { "match_all": {} },\n "filter": {\n "range": {\n "balance": {\n "gte": 20000,\n "lte": 30000\n }\n }\n }\n }\n }\n}]]]; nested: QueryParsingException[[tindices] [bool] query does not support [filter]]; }{[gD01n50TSmSJLgTL_gPDPw][tindices][3]: SearchParseException[[tindices][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [\n{\n "query": {\n "bool": {\n "must": { "match_all": {} },\n "filter": {\n "range": {\n "balance": {\n "gte": 20000,\n "lte": 30000\n }\n }\n }\n }\n }\n}]]]; nested: QueryParsingException[[tindices] [bool] query does not support [filter]]; }{[gD01n50TSmSJLgTL_gPDPw][tindices][4]: SearchParseException[[tindices][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [\n{\n "query": {\n "bool": {\n "must": { "match_all": {} },\n "filter": {\n "range": {\n "balance": {\n "gte": 20000,\n "lte": 30000\n }\n }\n }\n }\n }\n}]]]; nested: QueryParsingException[[tindices] [bool] query does not support [filter]]; }]",
"status" : 400
}


(David Pilato) #2

What is your elasticsearch version?


(Dilip Dwivedi) #3

1.7.3


(David Pilato) #4

So read the right documentation: https://www.elastic.co/guide/en/elasticsearch/reference/1.7/index.html

You are doing 2.x queries here.


(system) #5