Following is my elastic search - 1.5 Query:
{
"_source":["_id","spotlight"],
"query":{
"filtered":{
"filter":{
"and":[
{"term":{"gender":"female"}},
{"range":{"lastlogindate":{"gte":"2016-10-19 12:39:57"}}}
]
}
}
},
"filter":{
"and":[
{"term":{"maritalstatus":"1"}}
]
},
"sort":[{"member2_dummy7":{"order":"desc"}}],
"size":"600",
"aggs": {
"maritalstatus": {
"filter": {},
"aggs" : {
"filtered_maritalstatus": {"terms":{"field":"maritalstatus","size":5000}}
}
},
"relationship": {
"filter": {"term":{"maritalstatus":"1"}},
"aggs" : {
"filtered_relationship": {"terms":{"field":"relationship","size":5000}}
}
}
}
}
I converted same query in elastic 5.1 as given below:
{
"_source":["_id","spotlight"],
"query": {
"bool": {
"filter": [
{"term":{"gender":"female"}},
{"range":{"lastlogindate":{"gte":"2016-10-19 12:39:57"}}}
]
}
},
"post_filter": {"term":{"maritalstatus":"1"}},
"sort":[{"member2_dummy7":{"order":"desc"}}],
"size":"600",
"aggs": {
"maritalstatus": {
"filter": {},
"aggs" : {
"filtered_maritalstatus": {"terms":{"field":"maritalstatus","size":5000}}
}
},
"relationship": {
"filter": {"term":{"maritalstatus":"1"}},
"aggs" : {
"filtered_relationship": {"terms":{"field":"relationship","size":5000}}
}
}
}
}
I ran both queries on two different AWS instances of same configuration and finally, I came to know that elastic-search 5.1 query is taking exactly twice time of elastic-search 1.5 query to execute.
Can some tell me why elastic-search 5.1 query is running slower than elastic-search 1.5???? Is there any more query optimization required to make it run fast??