# Unified Highlighter throws too\_complex\_to\_determinize\_exception with \>288 filter terms

**URL:** <https://discuss.elastic.co/t/unified-highlighter-throws-too-complex-to-determinize-exception-with-288-filter-terms/261035>\
**Category:** Elasticsearch\
**Created:** [January 13, 2021, 6:35pm UTC](https://discuss.elastic.co/t/unified-highlighter-throws-too-complex-to-determinize-exception-with-288-filter-terms/261035 "2021-01-13T18:35:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![idoub](https://avatars.discourse-cdn.com/v4/letter/i/f05b48/32.png) [@idoub](https://discuss.elastic.co/u/idoub)\
**Post date:** [January 13, 2021, 6:35pm UTC](https://discuss.elastic.co/t/unified-highlighter-throws-too-complex-to-determinize-exception-with-288-filter-terms/261035/1 "2021-01-13T18:35:04Z")

</div>

There seems to be a problem with the Unified Highlighter in Lucene 8.6.2 that is affecting ElasticSearch 7.9.1. I already asked the Lucene developers if they knew of the bug and they said it's an ElasticSearch specific implementation problem.

If a search is performed with \>288 filter terms using the unified highlighter it throws a `too_complex_to_determinize_exception`, but if you switch to the plain highlighter it works fine. Alternatively, if you filter on a "copy\_to" field instead of the indexed field, it also works.

For the moment we have swapped to using the plain highlighter, but I was hoping there was a different solution.

This throws the error

```json
 {
    "highlight": {
        "type": "unified",
        "fields": {
            "title": {
                "require_field_match": false
            }
        }
    },
    "query": {
        "bool": {
            "must": [{
                "query_string": {
                    "query": "*"
                }
            }],
            "filter": [{
                "bool": {
                    "must": [{
                        "terms": {
                            "id": [">288 terms here"]
                        }
                    }]
                }
            }]
        }
    }
}

```

But this works fine

```json
 {
    "highlight": {
        "type": "plain",
        "fields": {
            "title": {
                "require_field_match": false
            }
        }
    },
    "query": {
        "bool": {
            "must": [{
                "query_string": {
                    "query": "*"
                }
            }],
            "filter": [{
                "bool": {
                    "must": [{
                        "terms": {
                            "id": [">288 terms here"]
                        }
                    }]
                }
            }]
        }
    }
}

```

Or if I adjust the search to use the copy\_to field it works as well (note "id" is now "\_id")

```json
 {
    "highlight": {
        "type": "unified",
        "fields": {
            "title": {
                "require_field_match": false
            }
        }
    },
    "query": {
        "bool": {
            "must": [{
                "query_string": {
                    "query": "*"
                }
            }],
            "filter": [{
                "bool": {
                    "must": [{
                        "terms": {
                            "_id": [">288 terms here"]
                        }
                    }]
                }
            }]
        }
    }
}

```

---

<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 10, 2021, 6:35pm UTC](https://discuss.elastic.co/t/unified-highlighter-throws-too-complex-to-determinize-exception-with-288-filter-terms/261035/2 "2021-02-10T18:35:15Z")

</div>

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