You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you've noted for cases like Operator the JsonEnum type does have an affordance for aliases for given enum values. So this should be an easy fix of just amending ZeroTermsQuery to add the all-caps variants as aliases.
I agree with you though, this should likely be handled in the spec somehow but not sure there's a standard for that and not sure we want to hand-edit exceptions. It's easy enough to work around if documented, but let's at least discuss options.
What is the bug?
The enum defined for the client uses lower case values for the
ZeroTermsQuery
enum:opensearch-java/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ZeroTermsQuery.java
Lines 38 to 42 in 08e7e65
However, this enum is defined on OpenSearch with traditional all-caps enum names:
As a result, a search query generated on OpenSearch can not simply transform its JSON into a client search request.
How can one reproduce the bug?
SearchSourceBuilder
:SearchSourceBuilder
to JSON:Note the value of
zero_terms_query
is all upper case.SearchRequest
object:What is the expected behavior?
In general, an OpenSearch
SearchSourceBuilder
can be serialized into JSON and then deserialized into an OpenSearch Java ClientSearchRequest
.In this particular case, the all-caps enum name should match case-insensitively rather than throwing an exception.
See, for example, how logical operators (such as the
OR
in this query) accept either all-upper or all-lower case:opensearch-java/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Operator.java
Lines 39 to 42 in 08e7e65
What is your host/environment?
Running this on OpenSearch 2.15 code, but it has not changed since pre-fork.
Do you have any additional context?
Relevant code block causing the issue on a feature branch:
https://github.com/opensearch-project/ml-commons/blob/feature/multi_tenancy/plugin/src/main/java/org/opensearch/ml/sdkclient/RemoteClusterIndicesClient.java#L230-L232
The text was updated successfully, but these errors were encountered: