Have a look at nested sort in docs: 
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#_nested_sorting_example

--
David ;-)
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


Le 9 juin 2014 à 00:12, Zdenek Pizl <[email protected]> a écrit :

Hallo,

 let's say I have following structure of document with nested (multiple) 
documents :

{
  "host": "server-001", 
   "plugins": [
    {
      "plugin_name": "function-c", 
      "plugin": {"function-c": "some C content" }
    }, 
    {
      "plugin_name": "function-a", 
      "plugin": {"function-a": "some A content" }
    }, 
    {
      "plugin_name": "function-b", 
      "plugin": {"function-b": "some B content" }
    }
   ]
}


I would like to get result of search with sorted nested plugins' objects, that 
is JSON with plugin_name item in 'function-a, function-b, function-c' sequence 
of nested documents. Is it even possible to achieve? If it is, how should the 
query and/or mapping look like?

I've tried i.e. '{ "query": { "match": { "host": "server-001" }}, "sort": { 
"plugins.plugin_name" : "asc" }}}' but it does not sort the nested block at all.

Thank you, regards Z. 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/09751eee-fd17-416a-98ba-f025ee381482%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/F200833A-E80F-4EBA-B4D9-C83D75B42790%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to