My expectation is that it should return me record no 1 first but it is returning record no 2 (as it has more score). Any idea what I am doing wrong here?
Have a look at this blog post, if you want to understand more how the score can be influenced by the number of shards in an index. It's worth noting that scores are calculated at the individual shard level, and the final sorting brings back the highest scoring results from each shard. In particular with small data sets this can lead to unexpected results.
Can you re-index your data set into an index with just one primary shard?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.