Sort by first element in an array of nested type

According to this link describing adding sorting by nested fields in ElasticSearch :

During sorting, either the highest (maximum) or the minimum (minimum) internal object is selected, depending on the sort_mode used.

Is there any way, instead of using the maximum or minimum value, it uses the first value of the array? For example, if the entry looks like this:

{
    "title": "Blah blah blah",
    "authors": [
        {
            "last": "Reiter",
            "first": "Jordan",
        },
        {
            "last": "Jim",
            "first": "Lee",
        }
    ]
}

And I want to sort by authors.last, authors.firstfor this record to use Reiter, Jordanfor sorting?

+4
source share
1 answer

Unfortunately no.

, , , ..

title: "Blah blah"
sortByAuthor: "Jordan Reiter"
authors: [
    ...
]

, script, , .

+2

Source: https://habr.com/ru/post/1527543/


All Articles