Dear all,
I'm trying to use the ilm explain api in the elasticsearch-java client. When I run the following code, I got an error, which is described below. Could someone please help me on this?
My dependencies:
<dependency>
<groupId>co.elastic.clients</groupId>
<artifactId>elasticsearch-java</artifactId>
<version>8.13.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.0</version>
</dependency>
Code:
final RestClient restClient = RestClient.builder(HttpHost.create("http://localhost:9200")).build();
final ElasticsearchTransport transport = new RestClientTransport(restClient, new JacksonJsonpMapper());
final ElasticsearchClient elasticsearchClient = new ElasticsearchClient(transport);
final ElasticsearchIlmClient ilmClient = elasticsearchClient.ilm();
final String indexName = "index_name";
final ExplainLifecycleResponse explainLifecycleResponse = ilmClient.explainLifecycle(b -> b.index(indexName));
When I run this code, I got the following error. It seems like it is related to the property "managed", which is a boolean in the result and it seems to expect a string.
Error:
Caused by: co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'VALUE_TRUE' instead of 'VALUE_STRING'
at co.elastic.clients.json.jackson.JacksonJsonpParser.expectNextEvent(JacksonJsonpParser.java:415)
at co.elastic.clients.json.jackson.JacksonJsonpParser.lookAheadFieldValue(JacksonJsonpParser.java:339)
at co.elastic.clients.json.JsonpUtils.lookAheadFieldValue(JsonpUtils.java:237)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:201)
... 19 more