Highlight feature - limitToMaxAnalyzedOffset - does still exist?

Hi everyone, I was wondering if you could help me.

I found an interesting feature added in a specific PR:

But I can't find documentation of how to use that using java HighLevel rest client. Was that removed?

That PR was for 7.12, and I'm using 7.8.1

I'm confused right now. Is that only allowed for .NET client?

You need 7.12. I just tried this:

    @Test
    void highlight() throws IOException {
        try {
            client.indices().delete(new DeleteIndexRequest("highlight"), RequestOptions.DEFAULT);
        } catch (ElasticsearchStatusException ignored) {
        }
        client.index(new IndexRequest("highlight").source("{\"foo\":\"bar\"}", XContentType.JSON), RequestOptions.DEFAULT);
        client.indices().refresh(new RefreshRequest("highlight"), RequestOptions.DEFAULT);
        client.search(new SearchRequest("highlight").source(
                new SearchSourceBuilder()
                    .query(QueryBuilders.matchQuery("foo", "bar"))
                    .highlighter(new HighlightBuilder().field("foo").maxAnalyzedOffset(10)
                    )
                ), RequestOptions.DEFAULT);
    }

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