I have elasticsearch index with single shard which contains 1.6 million documents. Host machine - 8G , Elasticsearch 3.5G.
When i run a simple match query on fieldA which has same value in entire document set (1.6 million) it is taking averagely 60ms.
When i run a simple match query on fieldB which has same value in 20 documents, it is taking averagely 2ms
I have set size as 0 and _source as false for both of above queries. Field A and B are just fields with array of strings, with mapping of lowercase filter and keyword tokenizer. Can someone explain why there is such a difference in execution time. I am thinking in both cases it first consult the inverted index to find the matched documents and return back the top document. Only difference i could see is total count. Will calculating the total hits causing the difference?
Elasticsearch Version : 1.3.2
Thanks for help in advance