# Facing this error "illegal\_argument\_exception: Fielddata is disabled"

**URL:** https://discuss.elastic.co/t/facing-this-error-illegal-argument-exception-fielddata-is-disabled/382044
**Category:** Elasticsearch
**Created:** [September 18, 2025, 7:07am UTC](https://discuss.elastic.co/t/facing-this-error-illegal-argument-exception-fielddata-is-disabled/382044 "2025-09-18T07:07:32Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Mihir\_Mistry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mihir_mistry/32/140345_2.png) [@Mihir\_Mistry](https://discuss.elastic.co/u/Mihir_Mistry)
#### Post date: [September 18, 2025, 7:07am UTC](https://discuss.elastic.co/t/facing-this-error-illegal-argument-exception-fielddata-is-disabled/382044/1 "2025-09-18T07:07:32Z")

</div>

I am working on a website that uses Elasticsearch for searching functionality, and the project has been working fine, but I am facing this error. You can see the error in the attached screenshot.

I just want to know if there is code related to this, so why am I facing the error  
Please help me with the solution

 ![Screenshot from 2025-09-16 15-58-27](https://us1.discourse-cdn.com/elastic/original/3X/b/f/bfdc090248d64c83f4d7f6c78f25a4c14be1b0cb.png)

---

<div class="post-metadata">

### Author: ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)
#### Post date: [September 18, 2025, 10:54am UTC](https://discuss.elastic.co/t/facing-this-error-illegal-argument-exception-fielddata-is-disabled/382044/2 "2025-09-18T10:54:15Z")

</div>

Hi @Mihir_Mistry,

Are you trying to perform an aggregation? Or perhaps sorting? That error is to do with the fact that the type of the field you are trying to use for that kind of operation is of type [`text`](https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/text) which isn't compatible with the operation. While you **can** set the [`fielddata` option](https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/text#fielddata-mapping-param) on the index settings to true, I would recommend adding [keyword](https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/keyword) fields for those fields to your index (if there is no `.keyword` field already available).

Hope that helps!
