I am storing Windows UNC paths in a path
field with the following mapping:
"path": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
},
"tree": {
"type": "text",
"analyzer": "custom_path_tree"
}
}
}
When I run this query:
{
"sort": [
{
"fs.path.keyword": {
"order": "desc"
}
}
],
"_source": "path",
"size": 1
}
I get a document with a path like \\foo\bar\FN1\FFF
. However, looking at the other documents in the index, I see others with a path \\foo\bar\FN15\EEE
.
I would have thought \
would come before 5
when sorting against a keyword field.
Why is it doing this and how can I get Elasticsearch to sort this field so that \\foo\bar\FN15\EEE
comes after \\foo\bar\FN1\FFF
?