# Error illegal\_argument\_exception : Text fields are not optimised for operations that require per-document field data

**URL:** <https://discuss.elastic.co/t/error-illegal-argument-exception-text-fields-are-not-optimised-for-operations-that-require-per-document-field-data/378597>\
**Category:** Kibana\
**Created:** [May 27, 2025, 2:18pm UTC](https://discuss.elastic.co/t/error-illegal-argument-exception-text-fields-are-not-optimised-for-operations-that-require-per-document-field-data/378597 "2025-05-27T14:18:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![diegolakers](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@diegolakers](https://discuss.elastic.co/u/diegolakers)\
**Post date:** [May 27, 2025, 2:18pm UTC](https://discuss.elastic.co/t/error-illegal-argument-exception-text-fields-are-not-optimised-for-operations-that-require-per-document-field-data/378597/1 "2025-05-27T14:18:16Z")

</div>

Hi,

i'm experiencing a problem that i'm not able to solve. After years of working with no problems (using ELK stack version 7.6), when i try to make a research in Kibana, it is shown this message:

"illegal\_argument\_exception

Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [values\_by\_column\_condition.date(date\_added)] in order to load field data by uninverting the inverted index. Note that this can use significant memory."

From what i read it seems a mapping problem, but the mapping of the problematic field seems correct to me (a text field that is saved also as a keyword):

"date(date\_added)" : {  
"type" : "text",  
"norms" : false,  
"fields" : { "keyword" : {"type" : "keyword", "ignore\_above" : 256} }  
}

If i ispect the details of the request, in the "docvalue\_fields" section i see this definition, that i don't understand since the field is a text/keyword

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/7/e793dda863fa0ccf9001c59b6f034e9427a54d93.png)  
If I remove it and launch the same request from the dev tools, the error disappear.

If anyone can help me I would be very grateful
