# Error: Fielddata is disabled on text fields

**URL:** https://discuss.elastic.co/t/error-fielddata-is-disabled-on-text-fields/166313
**Category:** Kibana
**Created:** [January 30, 2019, 9:15am UTC](https://discuss.elastic.co/t/error-fielddata-is-disabled-on-text-fields/166313 "2019-01-30T09:15:57Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![li\_jessen2016](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/li_jessen2016/32/38817_2.png) [@li\_jessen2016](https://discuss.elastic.co/u/li_jessen2016)
#### Post date: [January 30, 2019, 9:15am UTC](https://discuss.elastic.co/t/error-fielddata-is-disabled-on-text-fields/166313/1 "2019-01-30T09:15:57Z")

</div>

I am following the operation of the video "getting started with Elasticsearch", [https://www.elastic.co/webinars/getting-started-elasticsearch](https://www.elastic.co/webinars/getting-started-elasticsearch).

I post several indices into the Elasticsearch by using POST /inspections/\_doc/\_bulk, the documents of the indices include _"inspection\_score": 96_ . But when I use the following command to sort the documents according to the value of "inspection\_score", just as the video does.  
GET /inspections/\_doc/\_search  
{  
"query":{  
"range": {  
"inspection\_score": {  
"gte": 80  
}  
}  
},  
"sort":[  
{  
"inspection\_score": "desc"

```
}
]

```

}

I got the error: "Fielddata is disabled on text fields by default. Set fielddata=true on [inspection\_score] in order to load fielddata in memory by uninverting the inverted index.

Why? The video shows everything is fine. By the way, is "inspection\_score" of type text? I think it maybe number since in the POST command, I specify a number to the value of "inspection\_score".

---

<div class="post-metadata">

### Author: ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)
#### Post date: [January 30, 2019, 2:31pm UTC](https://discuss.elastic.co/t/error-fielddata-is-disabled-on-text-fields/166313/2 "2019-01-30T14:31:56Z")

</div>

hi @li_jessen2016

fielddata is indeed disabled by default on text-fields. For more info see here [https://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html#\_fielddata\_is\_disabled\_on\_literal\_text\_literal\_fields\_by\_default](https://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html#_fielddata_is_disabled_on_literal_text_literal_fields_by_default)

I would first check the mapping of your index, and verify what field-type the `inspection_score` field has.

---

<div class="post-metadata">

### Author: ![li\_jessen2016](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/li_jessen2016/32/38817_2.png) [@li\_jessen2016](https://discuss.elastic.co/u/li_jessen2016)
#### Post date: [January 31, 2019, 11:05am UTC](https://discuss.elastic.co/t/error-fielddata-is-disabled-on-text-fields/166313/3 "2019-01-31T11:05:25Z")

</div>

I delete the indices. And post in bulk again. It works. It maybe previously I used "96" text as the value of inspection\_score and it stayed there until I deleted them all.

---

<div class="post-metadata">

### Author: ![adityassa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adityassa/32/39157_2.png) [@adityassa](https://discuss.elastic.co/u/adityassa)
#### Post date: [January 31, 2019, 11:41am UTC](https://discuss.elastic.co/t/error-fielddata-is-disabled-on-text-fields/166313/4 "2019-01-31T11:41:55Z")

</div>

PUT /index\_name  
{  
_your mapping here_  
"mappings": {}  
}

First use this method to create a mapping for your index. Then push the data.

---

<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: [February 28, 2019, 11:54am UTC](https://discuss.elastic.co/t/error-fielddata-is-disabled-on-text-fields/166313/5 "2019-02-28T11:54:31Z")

</div>

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