From 71b8a2227fba86f94a404006ec070b320ab495c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 04:54:29 +0000 Subject: [PATCH 1/4] Bump co.elastic.clients:elasticsearch-java from 9.0.3 to 9.1.0 Bumps [co.elastic.clients:elasticsearch-java](https://github.com/elastic/elasticsearch-java) from 9.0.3 to 9.1.0. - [Release notes](https://github.com/elastic/elasticsearch-java/releases) - [Changelog](https://github.com/elastic/elasticsearch-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/elastic/elasticsearch-java/compare/v9.0.3...v9.1.0) --- updated-dependencies: - dependency-name: co.elastic.clients:elasticsearch-java dependency-version: 9.1.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a3c5073..aa9e593 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ - 9.0.3 + 9.1.0 2.19.2 2.25.1 2.0.17 From 8c3f6eb668072811aa7acd34a7a067f9c43410a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 04:54:43 +0000 Subject: [PATCH 2/4] Apply automatic changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e9510c7..c2cd528 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ I believe it could be beneficial for many, so I've made the code available here. You're welcome to contribute your own examples if you'd like. -This repository is tested against Elasticsearch 9.0.3. +This repository is tested against Elasticsearch 9.1.0. We automatically start a Docker image using the [Elasticsearch module for TestContainers](https://www.testcontainers.org/modules/elasticsearch/). From eabba859a1d4c08df9abec3560c69fc6d447dc99 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Fri, 1 Aug 2025 17:31:46 +0200 Subject: [PATCH 3/4] Fix highlighting breaking change --- .../fr/pilato/test/elasticsearch/hlclient/EsClientIT.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/java/fr/pilato/test/elasticsearch/hlclient/EsClientIT.java b/src/test/java/fr/pilato/test/elasticsearch/hlclient/EsClientIT.java index 976a61b..2bb18e8 100644 --- a/src/test/java/fr/pilato/test/elasticsearch/hlclient/EsClientIT.java +++ b/src/test/java/fr/pilato/test/elasticsearch/hlclient/EsClientIT.java @@ -31,6 +31,7 @@ import co.elastic.clients.elasticsearch.cat.ThreadPoolResponse; import co.elastic.clients.elasticsearch.cluster.PutComponentTemplateResponse; import co.elastic.clients.elasticsearch.core.*; +import co.elastic.clients.elasticsearch.core.search.HighlightField; import co.elastic.clients.elasticsearch.ilm.PutLifecycleResponse; import co.elastic.clients.elasticsearch.indices.*; import co.elastic.clients.elasticsearch.ingest.PutPipelineResponse; @@ -43,6 +44,7 @@ import co.elastic.clients.transport.endpoints.BinaryResponse; import co.elastic.clients.util.BinaryData; import co.elastic.clients.util.ContentType; +import co.elastic.clients.util.NamedValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -328,7 +330,8 @@ void highlight() throws IOException { final SearchResponse response = client.search(sr -> sr .index(indexName) .query(q -> q.match(mq -> mq.field("foo").query("bar"))) - .highlight(h -> h.fields("foo", hf -> hf.maxAnalyzedOffset(10))) + .highlight(h -> h + .fields(NamedValue.of("foo", HighlightField.of(hf -> hf.maxAnalyzedOffset(10))))) , Void.class); assertThat(response.hits().total()).isNotNull(); assertThat(response.hits().total().value()).isEqualTo(1); From b1269cd8810110a2583a07799e6abd1ece3339e9 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Fri, 1 Aug 2025 17:37:19 +0200 Subject: [PATCH 4/4] Fix ESQL response object It provides now more values: * `documents_found` * `values_loaded` --- .../test/elasticsearch/hlclient/EsClientIT.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/test/java/fr/pilato/test/elasticsearch/hlclient/EsClientIT.java b/src/test/java/fr/pilato/test/elasticsearch/hlclient/EsClientIT.java index 2bb18e8..e1c0d60 100644 --- a/src/test/java/fr/pilato/test/elasticsearch/hlclient/EsClientIT.java +++ b/src/test/java/fr/pilato/test/elasticsearch/hlclient/EsClientIT.java @@ -972,22 +972,16 @@ void esql() throws IOException, SQLException { { // Using the Raw ES|QL API try (final BinaryResponse response = client.esql().query(q -> q.query(query)); InputStream is = response.content()) { - // The response object is { - // "took" : 4, - // "is_partial" : false, - // "columns" : [ { - // "name" : "name", - // "type" : "text" - // } ], - // "values" : [ [ "David" ] ] - //} + // The response object is {"took":173,"is_partial":false,"documents_found":1,"values_loaded":1,"columns":[{"name":"name","type":"text"}],"values":[["David"]]} final ObjectMapper mapper = new ObjectMapper(); final JsonNode jsonNode = mapper.readTree(is); - assertThat(jsonNode).isNotNull().hasSize(4); + assertThat(jsonNode).isNotNull().hasSize(6); assertThat(jsonNode.get("columns")).isNotNull().hasSize(1).first().satisfies(column -> assertThat(column.get("name").asText()).isEqualTo("name")); assertThat(jsonNode.get("values")).isNotNull().hasSize(1).first().satisfies(value -> assertThat(value).hasSize(1).first().satisfies(singleValue -> assertThat(singleValue.asText()).isEqualTo("David"))); assertThat(jsonNode.get("took").asInt()).isGreaterThan(0); assertThat(jsonNode.get("is_partial").asBoolean()).isFalse(); + assertThat(jsonNode.get("documents_found").asLong()).isEqualTo(1); + assertThat(jsonNode.get("values_loaded").asLong()).isEqualTo(1); } }