Skip to content

Instantly share code, notes, and snippets.

@radu-gheorghe
Created April 28, 2013 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radu-gheorghe/5476348 to your computer and use it in GitHub Desktop.
Save radu-gheorghe/5476348 to your computer and use it in GitHub Desktop.
Elasticsearch should still show scores for each hit when sorting on a field and track_scores is true
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test/test/1 -d '{"foo": "bar"}'
curl -XPOST localhost:9200/test/_refresh
echo
echo "==============="
echo -e "\e[00;32mCORRECT: SCORE IS SHOWN WHEN SORTING ON SCORE\e[00m"
echo "==============="
curl 'localhost:9200/test/test/_search?q=bar&pretty' 2>/dev/null | grep score
echo
echo "==============="
echo -e "\e[00;32mCORRECT: SCORE IS NOT SHOWN WHEN SORTING ON FIELD\e[00m"
echo "==============="
curl 'localhost:9200/test/test/_search?q=bar&sort=foo&pretty' 2>/dev/null | grep score
echo
echo "==============="
echo -e "\e[00;31mINCORRECT: SCORE IS NOT SHOWN WHEN SORTING ON FIELD WITH TRACK_SCORES\e[00m"
echo "==============="
curl 'localhost:9200/test/test/_search?q=bar&sort=foo&track_scores=true&pretty' 2>/dev/null | grep score
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment