I'm trying make a search and sort the results. However, I'm getting a error dont know why.
EDIT - I'll provide my full mappings.
"myindex": {
"mappings": {
"mytype": {
"dynamic_templates": [
{
// Dynamic templates here!
}
],
"properties": {
"fieldid": {
"type": "keyword",
"store": true
},
"fields": {
"properties": {
"myfield": {
"type": "text",
"fields": {
"sort": {
"type": "keyword",
"ignore_above": 256
}
},
"analyzer": "myanalyzer"
}
}
},
"isDirty": {
"type": "boolean"
}
}
}
}
}
}
When I performed a search with sorting, like this:
POST /index/_search
{
"sort": [
{ "myfield.sort" : {"order" : "asc"}}
]
}
I get the following error:
{
"error": {
"root_cause": [
{
"type": "query_shard_exception",
"reason": "No mapping found for [myfield.sort] in order to sort on",
"index_uuid": "VxyKnppiRJCrrnXfaGAEfA",
"index": "index"
}
]
"status": 400
}
I'm following the documentation on elasticsearch. DOCUMENTATION
I also check this link: DOCUMENTATION
Can someone provided me help?