Sorting array items within single document

One of our indices contains documents that include an internal array. Say within a given document it contains the following:

"geoEntities" : [
"France",
"United States",
"China",
"Germany"
]

I want to be able to do a search that will only return a single document but have Elasticsearch return the document with the countries sorted like:
"geoEntities" : [
"China",
"France",
"Germany"
"United States"
]

I haven't found anything that says this is possible so I am hoping that someone can verify this one way or another.

Welcome to our community! :smiley:

Elasticsearch cannot do this for you sorry to say.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.