# Fuzzy\_terms\_exception when matching against keyword fields

**URL:** https://discuss.elastic.co/t/fuzzy-terms-exception-when-matching-against-keyword-fields/343057
**Category:** Elasticsearch
**Created:** [September 14, 2023, 2:19pm UTC](https://discuss.elastic.co/t/fuzzy-terms-exception-when-matching-against-keyword-fields/343057 "2023-09-14T14:19:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![David\_Kolb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_kolb/32/123188_2.png) [@David\_Kolb](https://discuss.elastic.co/u/David_Kolb)
#### Post date: [September 14, 2023, 2:19pm UTC](https://discuss.elastic.co/t/fuzzy-terms-exception-when-matching-against-keyword-fields/343057/1 "2023-09-14T14:19:52Z")

</div>

Hi,

I'm getting a  
`ElasticsearchException[Elasticsearch exception [type=fuzzy_terms_exception, reason=Term too complex`  
when running a fuzzy (AUTO) multi match query with a query String that contains long terms against a keyword field. I identified the same problem for other non-keyword fields as well, which I was able to solve by adding a _truncate_ filter to those fields. However, the _truncate_ filter can't be applied to keywords. I saw that one can specify a custom analyzer in the search request, which could do the truncation, but I think this is not what I should do as there are several other fields in my indices with custom analyzers.

I also saw that one can configure the fuzziness per term length, but only to increase the fuzziness at certain lengths. In my case, I actually want to decrease the fuzziness after a certain term length.

Is there some other way to make ES truncate the terms of the search query for keyword fields?  
I'm also using a quite old ES version 7.10.2, but AFAIK the truncate filter also can't be applied to keywords in the newest ES version.

---

<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: [October 12, 2023, 2:20pm UTC](https://discuss.elastic.co/t/fuzzy-terms-exception-when-matching-against-keyword-fields/343057/2 "2023-10-12T14:20:34Z")

</div>

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