# Can´t use the ilm explain in elasticsearch-java

**URL:** <https://discuss.elastic.co/t/can-t-use-the-ilm-explain-in-elasticsearch-java/358297>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [April 26, 2024, 2:00pm UTC](https://discuss.elastic.co/t/can-t-use-the-ilm-explain-in-elasticsearch-java/358297 "2024-04-26T14:00:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![heldergr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/heldergr/32/133900_2.png) [@heldergr](https://discuss.elastic.co/u/heldergr)\
**Post date:** [April 26, 2024, 2:00pm UTC](https://discuss.elastic.co/t/can-t-use-the-ilm-explain-in-elasticsearch-java/358297/1 "2024-04-26T14:00:51Z")

</div>

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:

```auto
		<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:

```auto
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:

```auto
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

```

---

<div class="post-metadata">

**Author:** ![ltrotta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ltrotta/32/124003_2.png) [@ltrotta](https://discuss.elastic.co/u/ltrotta)\
**Post date:** [April 26, 2024, 4:18pm UTC](https://discuss.elastic.co/t/can-t-use-the-ilm-explain-in-elasticsearch-java/358297/2 "2024-04-26T16:18:03Z")

</div>

Hello and welcome 🙂  
Thank you for the report and the code snippet, this is a bug we're aware of and will try to fix as soon as possible. There's an [issue on github](https://github.com/elastic/elasticsearch-java/issues/312) where you can track our progress on this.
