Sorting when "fields": [...] in query

(Zdenek Pizl) #1


is there any trick how to force ElsticSearch to sort results when using
"fields" option withn a query.

This query:

"curl -XPOST http://localhost:9200/stored-node/_search?pretty=1
-d'{"from":0, "size": 5, "fields": [ "host", "prefix", "displayname" ],
"query": { "regexp": { "host": ".*" }}, "sort": [{ "_id": { "order": "asc"}

does not return sorted item, meanwhile the same query WITHOUT "fields" part
returns correctly sorted data. But as i need only few info from every
record not the whole bunch of data, I'd like to use "fields" to limit
amount of data returned.

How to achieve sorted result when using the query above?

Thank you very much, regards .zp.


Zdenek Pizl

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit

(system) #2