I am trying to create mapping for a field which will need to be used only for exact matches and sorting. I don't want to set primary data type as text as I need to do only exact match.
{
"index_patterns": "*",
"mappings": {
"doc": {
"_source": {
"enabled": true
},
"properties": {
"my_field": {
"type": "keyword",
"index": true,
"fielddata": true
}
}
}
}
}
But I am getting the following error:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Mapping definition for [my_field] has unsupported parameters: [fielddata : true]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [doc]: Mapping definition for [my_field] has unsupported parameters: [fielddata : true]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Mapping definition for [my_field] has unsupported parameters: [fielddata : true]"
}
},
"status": 400
}
The problem is that without fielddata
sorting is no happening properly. For example following is the sample asc
sort output:
"90000001"
"90000001"
""
""
""
"90000008"
"9100000"