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


(Zdenek Pizl) #1

Hallo,

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
zdenek.pizl@gmail.com

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAETP4L909PqLL6hh_F%3D_KTriJZ7catcd0P6TBcWrn5rXisEVQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2