Created
May 23, 2011 11:04
-
-
Save jfiedler/986550 to your computer and use it in GitHub Desktop.
Strange secondary sorting of Elastic Search TermsFacet entries with identical hit count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XDELETE 'http://localhost:9200/test/' | |
curl -XPUT 'http://localhost:9200/test/' | |
curl -XPUT 'http://localhost:9200/test/test/1' -d ' | |
{ | |
"doc":{ | |
"string" : "foo" | |
} | |
} | |
' | |
curl -XPUT 'http://localhost:9200/test/test/2' -d ' | |
{ | |
"doc":{ | |
"string" : "bar" | |
} | |
} | |
' | |
curl -XGET 'http://localhost:9200/test/test/_search?pretty=true' -d ' | |
{ | |
"query" : { | |
"match_all" : { | |
} | |
}, | |
"facets" : { | |
"myFacet" : { | |
"terms" : { | |
"field" : "doc.string", | |
"size" : 10, | |
"order" : "count" | |
} | |
} | |
} | |
} | |
' | |
#Response shows strange secondary sorting by term value | |
... | |
"facets" : { | |
"myFacet" : { | |
"_type" : "terms", | |
"missing" : 0, | |
"terms" : [ { | |
"term" : "foo", | |
"count" : 1 | |
}, { | |
"term" : "bar", | |
"count" : 1 | |
} ] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment