Hi David, the example is known to me and probably it is not what I am looking for or I am doing something dumb. I'll try to explain it in deeper details.
Let's say we have 2 documents within index /sort-test/ with following mapping: *Creating an index and its mapping*: curl -XPUT http://localhost:9200/sort-test curl -XPUT 'http://localhost:9200/sort-test/node/_mapping' -d ' { "node": { "properties" : { "plugins" : { "type" : "nested"}, "host": { "index": "not_analyzed", "type": "string" }}}}' Documents: curl -XPOST http://localhost:9200/sort-test/node/ -d '{ "host": "server-002", "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" }} ] }' curl -XPOST http://localhost:9200/sort-test/node/ -d '{ "host": "server-001", "plugins": [ { "plugin_name": "function-x", "plugin": {"function-x": "some X content" }}, { "plugin_name": "function-d", "plugin": {"function-d": "some D content" }} ] }' And now I would like to get a document of host=server-001 in following form: '{ "host": "server-001", "plugins": [ * { "plugin_name": "function-d", "plugin": {"function-d": "some D content" }}* * { "plugin_name": "function-x", "plugin": {"function-x": "some X content" }}, * ] }' ^^^ Note there are plugins's nested items sorted in ascending order according to plugin_name. THAT is the result I need to achieve. I've tried following: curl -XPOST http://localhost:9200/sort-test/_search?pretty=1 -d'{ "query": { "match": { "host": "server-001" }}, "sort": { "plugins.plugin_name" : "asc" }}}' or curl -XPOST http://localhost:9200/sort-test/_search?pretty=1 -d'{ "query": { "match": { "host": "server-001" }}, "sort": { "plugins.plugin_name" : { "order": "asc", "nested_path": "plugins" } }}}' with no luck. The result is still the same, without sorted plugins items: { "took" : 3, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 1, "max_score" : null, "hits" : [ { "_index" : "sort-test", "_type" : "node", "_id" : "Zg41zMjwRYy77OU9vJ7YHQ", "_score" : null, "_source" : { "host": "server-001", "plugins": [ { "plugin_name": "function-x", "plugin": {"function-x": "some X content" }}, { "plugin_name": "function-d", "plugin": {"function-d": "some D content" }} ] }, "sort" : [ "d" ] } ] } } Any idea how to achieve this? Thank you in advance, regard .zp. -- > 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] <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/09751eee-fd17-416a-98ba-f025ee381482%40googlegroups.com > > <https://groups.google.com/d/msgid/elasticsearch/09751eee-fd17-416a-98ba-f025ee381482%40googlegroups.com?utm_medium=email&utm_source=footer> > . > 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/9d1e204e-6d2e-4d85-8c7b-bb7c7d608aed%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
