elastic / elasticsearch-java

Official Elasticsearch Java Client
Apache License 2.0
409 stars 239 forks source link

GetIndexTemplate call fails with MissingRequiredPropertyException: Missing required property 'IndexTemplate.composedOf' #729

Closed sothawo closed 6 months ago

sothawo commented 7 months ago

Java API client version

8.12.0

Java version

17.0.10

Elasticsearch Version

8.12.0

Problem description

Since version 8.12.0 the composedOf property of the IndexTemplate is not nullable anymore (https://github.com/elastic/elasticsearch-specification/blob/main/specification/indices/_types/IndexTemplate.ts#L40)

It is not possible now to read an index template that is not composed of other components. But this is still a valid case (see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-template.html#put-index-template-api-request-body, composedOf is optional).

Using the try ApiTypeHelper.DANGEROUS_disableRequiredPropertiesCheck(true)) workaround does not help, because the json deserializer tries to deserialize null into a list when adding this.

8.11.4 did not have this problem.

fabian-froehlich commented 7 months ago

Not sure wether this is a problem of the client, or the serverside. Posted this issue on the main project: https://github.com/elastic/elasticsearch/issues/104627

The line in the specification did not change for two years. And the client made no change between 8.11.4 and 8.12.0 https://github.com/elastic/elasticsearch-java/blob/v8.12.0/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplate.java#L58 https://github.com/elastic/elasticsearch-java/blob/v8.11.4/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplate.java#L58

The quoted API is for PUT-Requests and describes an optional parameter, that you can put in your body.

sothawo commented 7 months ago

The quoted API is for PUT-Requests and describes an optional parameter, that you can put in your body.

Yes, I saw that, but there is no documentation what get returns, so I linked that. Supposing that I can get back what I put in. I noticed because the build of spring-data-elasticsearch failed after the upgrade. Thanks for adding this bug to the main project.

marcgise commented 7 months ago

Does it still happens in 8.12.1 or do you find any workaround?

sothawo commented 7 months ago

The PR in the Elasticsearch project that restores the previous behaviour (https://github.com/elastic/elasticsearch/pull/105315) is tagged with v8.13. It seems we have to wait some time then.

sothawo commented 7 months ago

image wow, now planned for 8.14?

marcgise commented 7 months ago

I downgraded my system to 8.11.4 due to this bug... :(

sothawo commented 7 months ago

yeah, in 2 days there should be the milestone-1 release of Spring Data Elasticsearch 2024.0.0-M1 and I need to stay on 8.11 as well. Only waiting for the Spring Boot team to ask me to bump up to 8.12 before boot 3.3.0-M2 is released and then telling them "no".

frank-montyne commented 6 months ago

I have the same problem. Is very basic functionality, why does this have to take so long? Anyone aware of a workaround except for staying on 8.11.4?

sothawo commented 6 months ago

I saw that 8.12.2 was released yesterday, so this weekend I will check if Spring Data Elasticsearch can update.

Otherwise you probably can update your app to use 8.12, just don't use a server running 8.12.

sothawo commented 6 months ago

Seems to be fixed in 8.12.2, so this issue can be closed