Skip to content

Commit adbe5b7

Browse files
authored
Merge pull request #130 from dadoonet/dependabot/maven/co.elastic.clients-elasticsearch-java-8.16.0
Bump co.elastic.clients:elasticsearch-java from 8.15.3 to 8.16.0
2 parents 652ad7c + 3014ba7 commit adbe5b7

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ I believe it could be beneficial for many, so I've made the code available here.
1111

1212
You're welcome to contribute your own examples if you'd like.
1313

14-
This repository is tested against Elasticsearch 8.15.3.
14+
This repository is tested against Elasticsearch 8.16.0.
1515

1616
We automatically start a Docker image using the [Elasticsearch module for TestContainers](https://www.testcontainers.org/modules/elasticsearch/).
1717

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<properties>
1212
<!-- Main dependencies -->
13-
<elasticsearch.version>8.15.3</elasticsearch.version>
13+
<elasticsearch.version>8.16.0</elasticsearch.version>
1414
<jackson.version>2.18.1</jackson.version>
1515
<log4j.version>2.24.1</log4j.version>
1616
<slf4j.version>2.0.16</slf4j.version>

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

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import co.elastic.clients.elasticsearch.transform.GetTransformResponse;
4545
import co.elastic.clients.elasticsearch.transform.PutTransformResponse;
4646
import co.elastic.clients.json.JsonData;
47+
import co.elastic.clients.json.JsonpMappingException;
4748
import co.elastic.clients.json.jackson.JacksonJsonpMapper;
4849
import co.elastic.clients.transport.ElasticsearchTransport;
4950
import co.elastic.clients.transport.TransportException;
@@ -431,7 +432,7 @@ void rangeQuery() throws IOException {
431432
client.indices().refresh(rr -> rr.index(indexName));
432433
SearchResponse<ObjectNode> response = client.search(sr -> sr.index(indexName)
433434
.query(q -> q.range(rq -> rq
434-
.number(nrq -> nrq.field("foo").from(0.0).to(1.0))
435+
.number(nrq -> nrq.field("foo").gte(0.0).lte(1.0))
435436
))
436437
, ObjectNode.class);
437438
assertNotNull(response.hits().total());
@@ -924,28 +925,39 @@ void esql() throws IOException, SQLException {
924925

925926
// Using the Raw ES|QL API
926927
try (BinaryResponse response = client.esql().query(q -> q.query(query)); InputStream is = response.content()) {
927-
// The response object is {"columns":[{"name":"country","type":"text"}],"values":[["france"]]}
928+
// The response object is {"took":5,"columns":[{"name":"name","type":"text"}],"values":[["David"]]}
928929
ObjectMapper mapper = new ObjectMapper();
929930
JsonNode node = mapper.readTree(is);
930931
assertNotNull(node);
931-
assertEquals(2, node.size());
932+
assertEquals(3, node.size());
932933
assertEquals(1, node.get("columns").size());
933934
assertEquals("name", node.get("columns").get(0).get("name").asText());
934935
assertEquals(1, node.get("values").size());
935936
assertEquals("David", node.get("values").get(0).get(0).asText());
937+
assertTrue(node.get("took").asInt() > 0);
936938
}
937939

938940
// Using the JDBC ResultSet ES|QL API
941+
// And this is now failing because of https://github.com/elastic/elasticsearch-java/pull/903
939942
try (ResultSet resultSet = client.esql().query(ResultSetEsqlAdapter.INSTANCE, query)) {
943+
fail("https://github.com/elastic/elasticsearch-java/pull/903 have been fixed. Update the code.");
940944
assertTrue(resultSet.next());
941945
assertEquals("David", resultSet.getString(1));
946+
} catch (JsonpMappingException e) {
947+
// This is expected as we have this issue https://github.com/elastic/elasticsearch-java/pull/903
942948
}
943949

944950
// Using the Object ES|QL API
945-
Iterable<Person> persons = client.esql().query(ObjectsEsqlAdapter.of(Person.class), query);
946-
for (Person person : persons) {
947-
assertNull(person.getId());
948-
assertNotNull(person.getName());
951+
// And this is now failing because of https://github.com/elastic/elasticsearch-java/pull/903
952+
try {
953+
Iterable<Person> persons = client.esql().query(ObjectsEsqlAdapter.of(Person.class), query);
954+
fail("https://github.com/elastic/elasticsearch-java/pull/903 have been fixed. Update the code.");
955+
for (Person person : persons) {
956+
assertNull(person.getId());
957+
assertNotNull(person.getName());
958+
}
959+
} catch (JsonpMappingException e) {
960+
// This is expected as we have this issue https://github.com/elastic/elasticsearch-java/pull/903
949961
}
950962
}
951963

0 commit comments

Comments
 (0)