Hello, please help.
I have three indices A, B, C and I need multiple search with sorting by index order
B, A, C. So lexicographical sorting result is not suitable and I want create _meta field for order
B - 1
A - 2
C - 3
Adding _meta field
POST B
{
"mappings": {
"user": {
"_meta": {
"sort_order" : 1
}
}
}
}
Mapping
"mappings" : {
"user" : {
"_meta" : {
"sort_order" : 1
},
"dynamic_templates" : [
{
"string_as_keyword" : {
"match_mapping_type" : "string",
"mapping" : {
"fields" : {
"raw" : {
"type" : "keyword"
}
},
"type" : "keyword"
}
}
}
],
"properties" : {
"foo" : {
"type" : "keyword",
"fields" : {
"raw" : {
"type" : "keyword"
}
}
}
}
}
And do sorting via _meta.sorting_order.
POST /B/_search?
{
"size" : 10000,
"sort" : [
{ "_meta.sort_order" : {"order" : "asc"} }
]
}
But I get
"root_cause": [
{
"type": "query_shard_exception",
"reason": "No mapping found for [_meta.sort_order] in order to sort on",
"index_uuid": "hJS-64PbS76lZpJduVWhdw",
"index": "B"
}
]
What I do wrong?