Skip to content

Commit eabba85

Browse files
committed
Fix highlighting breaking change
1 parent 8c3f6eb commit eabba85

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/test/java/fr/pilato/test/elasticsearch/hlclient/EsClientIT.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import co.elastic.clients.elasticsearch.cat.ThreadPoolResponse;
3232
import co.elastic.clients.elasticsearch.cluster.PutComponentTemplateResponse;
3333
import co.elastic.clients.elasticsearch.core.*;
34+
import co.elastic.clients.elasticsearch.core.search.HighlightField;
3435
import co.elastic.clients.elasticsearch.ilm.PutLifecycleResponse;
3536
import co.elastic.clients.elasticsearch.indices.*;
3637
import co.elastic.clients.elasticsearch.ingest.PutPipelineResponse;
@@ -43,6 +44,7 @@
4344
import co.elastic.clients.transport.endpoints.BinaryResponse;
4445
import co.elastic.clients.util.BinaryData;
4546
import co.elastic.clients.util.ContentType;
47+
import co.elastic.clients.util.NamedValue;
4648
import com.fasterxml.jackson.core.type.TypeReference;
4749
import com.fasterxml.jackson.databind.JsonNode;
4850
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -328,7 +330,8 @@ void highlight() throws IOException {
328330
final SearchResponse<Void> response = client.search(sr -> sr
329331
.index(indexName)
330332
.query(q -> q.match(mq -> mq.field("foo").query("bar")))
331-
.highlight(h -> h.fields("foo", hf -> hf.maxAnalyzedOffset(10)))
333+
.highlight(h -> h
334+
.fields(NamedValue.of("foo", HighlightField.of(hf -> hf.maxAnalyzedOffset(10)))))
332335
, Void.class);
333336
assertThat(response.hits().total()).isNotNull();
334337
assertThat(response.hits().total().value()).isEqualTo(1);

0 commit comments

Comments
 (0)