Max length of a field exceeded error


I'm on elasticsearch 7.0.0, And been getting the error in elasticsearch logs like below:

org.elasticsearch.transport.RemoteTransportException: [host][ip:9300][indices:data/read/search[phase/fetch/id]]
Caused by: java.lang.IllegalArgumentException: The length of [index.keyword] field of [some_doc] doc of [index] index has exceeded [1000000] - maximum allowed to be analyzed for highlighting. This maximum can be set by changing the [index.highlight.max_analyzed_offset] index level setting. For large texts, indexing with offsets or term vectors is recommended!
        at ~[elasticsearch-7.0.0.jar:7.0.0]
        at ~[elasticsearch-7.0.0.jar:7.0.0]
        at ~[elasticsearch-7.0.0.jar:7.0.0]
        at$executeFetchPhase$3( ~[elasticsearch-7.0.0.jar:7.0.0]
        at$3.doRun( ~[elasticsearch-7.0.0.jar:7.0.0]
        at ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun( ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun( ~[elasticsearch-7.0.0.jar:7.0.0]
        at ~[elasticsearch-7.0.0.jar:7.0.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker( ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$ ~[?:?]
        at [?:?]

I used term_vector for some large fields as suggested in the error message above. But it increases the index size (with_positions_offsets). And also after fixing few large fields, i started getting error for other fields whose values are large in only very few documents, but in most documents they are very small. (Is it okay to define those fields as term_vectors too?)

Seems like this error occurs for only [index.keyword] fields, which are i suppose used for aggregation.

So, looking at the error it seems like there are two ways to solve this problem.

  1. Disable highlighting on those indices. (Assuming the problem occurs only during highlighting).
  2. Disable aggregation on large fields. (Assuming the problem is only with .keyword fields)

Can you please suggest which is the right approach in this case?

Anyone? thoughts?

Please do not ping people not already involved in the thread. This forum is manned by volunteers so you need to be patient.

1 Like


Adding this to Christian's answer:

Read this and specifically the "Also be patient" part.

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.

Yeah, thanks for the pointer. I'll try to follow that.

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