opensearch-project / opensearch-java

Java Client for OpenSearch
Apache License 2.0
124 stars 183 forks source link

[BUG] Major inconsistencies between Java client and OpenSearch API #420

Open AmiStrn opened 1 year ago

AmiStrn commented 1 year ago

What is the bug?

Many API's are broken and unusable using the client due to the fact that the auto-generated code is relying on a later Elasticsearch version where the API has changed since 7.10.2

How can one reproduce the bug?

run

GetSnapshotResponse getSnapshotResponse = javaClient().snapshot().get(g -> g.repository(“test-repository”).snapshot(“test-snapshot-5"));

fails with:

error: Missing required property ‘GetSnapshotResponse.total’

what is this field total? see it here in the elasticsearch docs version 8:

total (integer) The total number of snapshots that match the request when ignoring size limit or after query parameter.

Notice that the param is missing from the response body in same docs page in version 7.10

What is the expected behavior?

A valid response with no errors

This is causing the client to be impractical for use in production from our standpoint. as it seems to be auto-generated from an incompatible Elasticsearch client!

AmiStrn commented 1 year ago

Thanks @MarinaRazumovsky for finding these issues 💪

reta commented 1 year ago

Thanks @AmiStrn , that's the real issue, we are looking into multiple ways to deal with that:

As of now, we are more reactive than proactive - fixing the APIs which people use and report inconsistencies with.

reta commented 1 year ago

PS: This is not just opensearch-java issue but covers all clients fleet.

AmiStrn commented 1 year ago

Thank you @reta for the quick response, I was led to use the client by the docs. And we wish to use the official client.

fixing the APIs which people use and report inconsistencies with

Currently, that list is long. We can fix some, but it seems like a futile task since the base code needs to be taken from a client that is compatible with elasticsearch 7.10. And then we would gladly build on top of that.