Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting score null in Elastic search

{"query":{"bool": {"must": {"match": {"query": ["java"] }}}}}, 
  "sort": {"_timestamp" : "desc"}}

executing above query I am getting max_score and _score is NULL like this

 "max_score": null
like image 385
Badri Avatar asked Dec 23 '16 12:12

Badri


1 Answers

The reason is because you use custom sorting. Since you need to sort by timestamp, elasticsearch will omit the scoring.

Check https://www.elastic.co/guide/en/elasticsearch/guide/current/_sorting.html for more.

If you want the _score to be calculated regardless, you can set the track_scores parameter to true.

like image 199
Alkis Kalogeris Avatar answered Oct 19 '22 22:10

Alkis Kalogeris