Skip to content

Bump co.elastic.clients:elasticsearch-java from 8.15.3 to 8.16.0 #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 8.15.3.
This repository is tested against Elasticsearch 8.16.0.

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

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<properties>
<!-- Main dependencies -->
<elasticsearch.version>8.15.3</elasticsearch.version>
<elasticsearch.version>8.16.0</elasticsearch.version>
<jackson.version>2.18.1</jackson.version>
<log4j.version>2.24.1</log4j.version>
<slf4j.version>2.0.16</slf4j.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import co.elastic.clients.elasticsearch.transform.GetTransformResponse;
import co.elastic.clients.elasticsearch.transform.PutTransformResponse;
import co.elastic.clients.json.JsonData;
import co.elastic.clients.json.JsonpMappingException;
import co.elastic.clients.json.jackson.JacksonJsonpMapper;
import co.elastic.clients.transport.ElasticsearchTransport;
import co.elastic.clients.transport.TransportException;
Expand Down Expand Up @@ -431,7 +432,7 @@ void rangeQuery() throws IOException {
client.indices().refresh(rr -> rr.index(indexName));
SearchResponse<ObjectNode> response = client.search(sr -> sr.index(indexName)
.query(q -> q.range(rq -> rq
.number(nrq -> nrq.field("foo").from(0.0).to(1.0))
.number(nrq -> nrq.field("foo").gte(0.0).lte(1.0))
))
, ObjectNode.class);
assertNotNull(response.hits().total());
Expand Down Expand Up @@ -924,28 +925,39 @@ void esql() throws IOException, SQLException {

// Using the Raw ES|QL API
try (BinaryResponse response = client.esql().query(q -> q.query(query)); InputStream is = response.content()) {
// The response object is {"columns":[{"name":"country","type":"text"}],"values":[["france"]]}
// The response object is {"took":5,"columns":[{"name":"name","type":"text"}],"values":[["David"]]}
ObjectMapper mapper = new ObjectMapper();
JsonNode node = mapper.readTree(is);
assertNotNull(node);
assertEquals(2, node.size());
assertEquals(3, node.size());
assertEquals(1, node.get("columns").size());
assertEquals("name", node.get("columns").get(0).get("name").asText());
assertEquals(1, node.get("values").size());
assertEquals("David", node.get("values").get(0).get(0).asText());
assertTrue(node.get("took").asInt() > 0);
}

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

// Using the Object ES|QL API
Iterable<Person> persons = client.esql().query(ObjectsEsqlAdapter.of(Person.class), query);
for (Person person : persons) {
assertNull(person.getId());
assertNotNull(person.getName());
// And this is now failing because of https://github.com/elastic/elasticsearch-java/pull/903
try {
Iterable<Person> persons = client.esql().query(ObjectsEsqlAdapter.of(Person.class), query);
fail("https://github.com/elastic/elasticsearch-java/pull/903 have been fixed. Update the code.");
for (Person person : persons) {
assertNull(person.getId());
assertNotNull(person.getName());
}
} catch (JsonpMappingException e) {
// This is expected as we have this issue https://github.com/elastic/elasticsearch-java/pull/903
}
}

Expand Down
Loading