Deprecation of filtered in elasticsearch 2.0


(Anirudh Modi) #1

With elasticsearch 2.0 filtered will be deprecated. Instead of which we need to use bool..
In filtered it was mentioned that filtered query will run the filter before the query.. How will this work with bool?


(Jörg Prante) #2

Maybe you have missed this blog post? https://www.elastic.co/blog/better-query-execution-coming-elasticsearch-2-0


(Anirudh Modi) #3

Yes i did missed it out.. Never ran into this blog.. Thanks


(mramaprasad) #4

I have the following query which has bool query and a filter.
curl -XGET 'http://localhost:9200/cstest/teset1/_search?pretty=true' -d '
{
"from" : 0,
"size" : 10,
"query" : {
"bool" : {
"must" : {
"multi_match" : {
"query" : "java",
"fields" : [ "title", "description" ]
}
},
“filter”:[
{ "range": { "pubdate": { "gte": "2014-01-01" }}}
]

}

}
}’

This gives me the following error.
reason" : "bool query does not support [“filter”]",
Any ideas wjhat I am doing wrong?


(Shane Connelly) #5

Eeks! @mramaprasad you have the wrong quote double-quote character there.

You have “filter” and it should be "filter". The blog post uses the wrong double-quote characters as well, so it's no good if you copied/pasted from that. Sorry for that!


(Colin Goodheart-Smithe) #6

@mramaprasad please do not ask the same question in many threads. You have also asked this in Elasticsearch 2 - filtered query and Filtered query in Elasticsearch 2 all within a few hours. Be patient when waiting for an answer to your questions, this is a community forum and therefore you may not get an immediate response to your questions (see https://www.elastic.co/community/codeofconduct for more details)


(system) #7