jlarroque
(José Luis Larroque)
April 29, 2021, 1:08pm
1
Hi everyone, I was wondering if you could help me.
I found an interesting feature added in a specific PR:
Add a `max_analyzed_offset` query parameter to allow users
to limit the highlighting of text fields to a value less than or equal to the
`index.highlight.max_analyzed_offset`, thus avoiding an exception when
the length of the text field exceeds the limit. The highlighting still takes place,
but stops at the length defined by the new parameter.
Closes: #52155
elastic:master
← matriv:limitHighlighting
opened 10:05AM - 12 Jan 21 UTC
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
jlarroque
(José Luis Larroque)
April 29, 2021, 1:19pm
2
I'm confused right now. Is that only allowed for .NET client?
dadoonet
(David Pilato)
April 29, 2021, 1:45pm
3
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);
}
system
(system)
Closed
May 27, 2021, 1:45pm
4
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.