Hi everybody,
I want to sort the following example documents by the first array value of the field "name":
curl -X PUT "localhost:9200/my-index-000001/_doc/1?refresh&pretty" -H 'Content-Type:
application/json' -d'
{
"name": ["arthor", "chris"]
}
'
curl -X PUT "localhost:9200/my-index-000001/_doc/2?refresh&pretty" -H 'Content-Type:
application/json' -d'
{
"name": ["bunis", "bunas"]
}
'
curl -X PUT "localhost:9200/my-index-000001/_doc/3?refresh&pretty" -H 'Content-Type:
application/json' -d'
{
"name": ["chris", "arthor"]
}
'
with the following query:
curl -X GET "localhost:9200/_search?pretty" -H 'Content-Type: application/json' -d'
{
"query" : {
"wildcard" : {
"name" : {
"value" :"*"
}
}
},
"sort" : [
{"name.keyword" : {"order" : "asc", "mode" : "min"}}
]
}
'
But the result is:
- ["arthor", "chris"]
- ["chris", "arthor"]
- ["bunis", "bunas"]
I would expect the following result:
- ["arthor", "chris"]
- ["bunis", "bunas"]
- ["chris", "arthor"]
as hinted in the reference docs:
by the sort mode option.
Is this a bug or just not intended for arrays of strings?
Elasticsearch version used: 7.12.1
Thanks in advance for any help!