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

**URL:** <https://discuss.elastic.co/t/error-no-mapping-found-for-dbaname-in-order-to-sort-on/65673>\
**Category:** Elasticsearch\
**Created:** [November 10, 2016, 2:30pm UTC](https://discuss.elastic.co/t/error-no-mapping-found-for-dbaname-in-order-to-sort-on/65673 "2016-11-10T14:30:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JackOfAllDevs](https://avatars.discourse-cdn.com/v4/letter/j/f05b48/32.png) [@JackOfAllDevs](https://discuss.elastic.co/u/JackOfAllDevs)\
**Post date:** [November 10, 2016, 2:30pm UTC](https://discuss.elastic.co/t/error-no-mapping-found-for-dbaname-in-order-to-sort-on/65673/1 "2016-11-10T14:30:51Z")

</div>

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"}}]
}
```

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [November 10, 2016, 3:00pm UTC](https://discuss.elastic.co/t/error-no-mapping-found-for-dbaname-in-order-to-sort-on/65673/2 "2016-11-10T15:00:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [November 10, 2016, 3:02pm UTC](https://discuss.elastic.co/t/error-no-mapping-found-for-dbaname-in-order-to-sort-on/65673/3 "2016-11-10T15:02:51Z")

</div>

[https://www.elastic.co/guide/en/elasticsearch/reference/5.0/search-request-sort.html#\_memory\_considerations](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.
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 8, 2016, 3:02pm UTC](https://discuss.elastic.co/t/error-no-mapping-found-for-dbaname-in-order-to-sort-on/65673/4 "2016-12-08T15:02:55Z")

</div>

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