I am trying to query in Elasticsearch, but time and again I am getting a different result set from elasticsearch for same query. My cluster is having 3 shards and 2 replicas. My first guess was this might be happening because of shards in action there fore I tried querying with dfs_query_then_fetch but still I am having the same issue, after a lot a searching through I found out that the shard to which it is searching on is changing so I used preference to query. Still I observe the same issue. I am out of options now unable to figure out what is the issue. Pasting my query here
POST _search?search_type=dfs_query_then_fetch&preference=metiswayfinder
{
"query": {
"multi_match" : {
"query": "this is a test",
"fields": [ "subject^3", "message" ]
}
},
"sort" : [ {
"_score" : {
"order" : "desc"
}
}, {
"incidentcount" : {
"order" : "desc"
}
} ]}
Relevance score is vital for me, also I observe that the score keeps on changing everytime I do a search. Elasticsearch is giving inconsistent result set and inconsistent score. Any way by which I can neutralize these two scenarios without much change.