How to filter documents in elasticsearch 2.2 before executing query. I refered this page, but still couldn't frame correct query.
https://www.elastic.co/guide/en/elasticsearch/reference/2.2/query-filter-context.html
{
"size" : 9999,
"query" : {
"bool" : {
"filter" : {
"bool" : {
"must" : [ {
"exists" : {
"field" : "dvd"
}
} ]
}
},
"should" : [{
"bool" : {
"must" : [ {
"match" : {
"rec" : {
"query" : "CKS",
"type" : "boolean"
}
}
}, {
"match" : {
"date" : {
"query" : "2016-03-09",
"type" : "boolean"
}
}
} ]
}
}]
}
}
}
This is what i am trying to do.. I am having lot of Should clauses with each having 2 Must clause. Any one of should clause should match to retrieve the document. I have included only one should clause to make it simple. Query is working perfect. I want to apply filter over this. Filter documents before querying. But this is not working.
I am using Elasticsearch 2.2 ... Please let me know how to filter documents in this version of elasticsearch.
I think post filter is for different purpose.