Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Need to access new index setting made available in serverless #589

Open
dvjyothsna opened this issue Jul 31, 2023 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@dvjyothsna
Copy link

Suppose someone were working on a new serverless api that adds a new read only setting to an index called x. What would be a good way for the opensearch java client to support users of serverless who wants to read the setting?

@dvjyothsna dvjyothsna added enhancement New feature or request untriaged labels Jul 31, 2023
@dblock
Copy link
Member

dblock commented Aug 2, 2023

AFAIK it’s the same problem as wanting to support multiple versions of OpenSearch, with semver in mind. I see it work as follows.

At dev time, a custom schema for each version and flavor of server-side OpenSearch is consumed by the client. Each schema generates complete clients, e.g. opensearch.aoss.client.Client() will be generated from AOSS 2.3 schema, and opensearch.oss.client.Client() will be generated from OpenSearch 2.9 schema.

A sum of all schemas generates opensearch.client.Client(). Methods are annotated with all versions that they exist in, e.g. AOSS 2.3 and OS 2.9.

An intersection of all schemas generates opensearch.all.client.Client().

At runtime the generated code examines any response for server version on every response, so now it knows whether it's talking to AOSS 2.3 vs. OSS 2.9.

At runtime the generated code can check whether the method being called exists in the flavor being communicated with by comparing the annotations and produce warnings or errors.

For your example the setting being added exists in opensearch.aoss.client and opensearch.client, but not in opensearch.os.client. If I talk to OS with the setting via opensearch.client it fails loudly, and if I talk to AOSS it works.

WDYT?

@wbeckler wbeckler removed the untriaged label Aug 3, 2023
@wbeckler
Copy link

wbeckler commented Aug 3, 2023

I can think of a few approaches. One would be to allow for untyped responses to be parsed as json:
#377

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants