elasticsearch-java icon indicating copy to clipboard operation
elasticsearch-java copied to clipboard

Missing required property 'MultiTermVectorsOperation.doc'

Open jerryguowei opened this issue 2 years ago • 2 comments

Java API client version

7.17.5

Java version

11

Elasticsearch Version

7.17.5

Problem description

I got the error exceptions

Missing required property 'MultiTermVectorsOperation.doc'
co.elastic.clients.util.MissingRequiredPropertyException: Missing required property 'MultiTermVectorsOperation.doc'
	at co.elastic.clients.util.ApiTypeHelper.requireNonNull(ApiTypeHelper.java:76)
	at co.elastic.clients.elasticsearch.core.mtermvectors.MultiTermVectorsOperation.<init>(MultiTermVectorsOperation.java:88)
	at co.elastic.clients.elasticsearch.core.mtermvectors.MultiTermVectorsOperation.<init>(MultiTermVectorsOperation.java:57)
	at co.elastic.clients.elasticsearch.core.mtermvectors.MultiTermVectorsOperation$Builder.build(MultiTermVectorsOperation.java:435)

I checked the elastic official docs, only the id, fields, index are mandatory, but in version 7.17.5, a lot of other fields in the this class are mandatory. BTW, the code for version 8 is correct.

jerryguowei avatar Jun 29 '22 07:06 jerryguowei

Is there any plan to fix this bugs in 7.17? 7.17 is the last version of 7. And I believe most users still need to upgrade to 7.17, then to 8. which is also recommended by elastic https://www.elastic.co/guide/en/elastic-stack/current/upgrading-elastic-stack.html#prepare-to-upgrade.

I know this bug not exist in version 8, but still prevent users to use 7.17. And MultiTermVectorsOperation is an important operation in elasticSearch.

jerryguowei avatar Aug 13 '22 11:08 jerryguowei

For the same API, the response MultiTermVectorsResult also have issues in version 7.17.6. we got the error when deserialize the response Missing required property for MultiTermVectorsResult.id

Look at the code in 7.17, we can find that the property name in the Deserializer is not correct. The correct property name is _id, _index, and _version

this api is completely not working at version 7.17 because of this wrong naming in the Deserializer

https://github.com/elastic/elasticsearch-java/blob/7.17/java-client/src/main/java/co/elastic/clients/elasticsearch/core/mtermvectors/MultiTermVectorsResult.java#L291-L292

The code for version 8 is also correct.

jerryguowei avatar Aug 26 '22 05:08 jerryguowei