ElasticSearch sort order for multiple fields -
what best way specify sort order in elasticsearch multiple fields? query string format not seem work @ all:
http://elasticsearch_url/index/_search?sort=field1:asc&sort=field2:desc&size=100
one sort first field1, field2, 1 of fields seems sorted correctly. full notations works better, first entries have wrong search order:
curl -s -xget http://elasticsearch_url/index/_search -d ' { "sort": [ { "field1": { "order": "desc" }}, { "field2": { "order": "desc" }} ], "size": 100 }'
apparently second, full notation works better.
there problem 1 of fields contained urls, parsed in odd ways elasticsearch. normal string fields can difficult sort, indexing url in elasticsearch more difficult.
Comments
Post a Comment