Error No mapping found for [DBANAME] in order to sort on

I have a mapping that includes "DBAName" and I can search/query based on that field. It shows up in all my results.

But, when I try to sort by that field, I get: "No mapping found for [DBANAME] in order to sort on"

The mapping looks like:

"DBAName" : {
    "type": "string",
    "fielddata": true
},

My query looks like:

GET /provider/providers/_search
{
   "query": { 
     "bool": { 
       "must": [
                   {
                      "match": {
                         "DBAName": "Hospice" 
                      }
                   },
                   {
                      "match": {
                         "ProviderAddress.State": "CA" 
                      }
                   }
                ]
     }
   },
   "sort": [{"DBAName": {"order":"desc"}}]
}

Not shure it's a good answer but I wonder if you can sort on a String analyzed field... I think you have to sort on a not_analyzed field.

https://www.elastic.co/guide/en/elasticsearch/reference/5.0/search-request-sort.html#_memory_considerations

For string based types, the field sorted on should not be analyzed / tokenized.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.