sudo-suhas/elastic-builder

Highlight.max_analyzed_offset not included in Highlight object

Opened this issue · 1 comments

Hello,

I've just started using this library and its amazing, thank you for such a beautiful work!

I'm indexing big documents and I've been getting the max_analyzed_offset error.

The issue is that I can set a max_analyzed_offset for the indice creation but not for the Highlight query like it's mentioned on the docs:

max_analyzed_offset
By default, the maximum number of characters analyzed for a highlight request is bounded by the value defined in the [index.highlight.max_analyzed_offset](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-max-analyzed-offset) setting, and when the number of characters exceeds this limit an error is returned. If this setting is set to a non-negative value, the highlighting stops at this defined maximum limit, and the rest of the text is not processed, thus not highlighted and no error is returned. The [max_analyzed_offset](https://www.elastic.co/guide/en/elasticsearch/reference/current/highlighting.html#max-analyzed-offset) query setting does not override the [index.highlight.max_analyzed_offset](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-max-analyzed-offset) which prevails when it’s set to lower value than the query setting.

Url is: https://www.elastic.co/guide/en/elasticsearch/reference/current/highlighting.html

Right now, I'm being forced to bump the index.highlight.max_analyzed_offset to 3000000 which is not desirable as can eats lots of memory on searches.

Could this feature be enabled somehow?

Thank you!

This setting was added in Elasticsearch 7.12. A PR to add this feature to highlighting would be welcome.