-
Notifications
You must be signed in to change notification settings - Fork 186
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
Typed keys in aggregation results cannot be switched off #741
Comments
This is an awkward feature. Are those typed keys added client or server side? Can you get two aggregations with the same name and different type? Either way giving the option make sense, want to try to implement it @fs-chris? Long story is that I'd prefer a non-ambiguous response where the key is always the same, and that the body of the aggregation response contains either the separate name of the aggregation and the type, or vice-versa. |
I suppose (without having looked into the code) that this is added by the client. The client prefixes the aggregation's name in the request which then occurs identically in the response, since the server does not touch the aggregation's name. In the response it is then used for determining the target type before parsing the aggregation's result. I.e., the aggregation's key contains the target type that is used to decide how to parse the actual result body. |
Hi, is there a way to disable this mechanism in opensearch-java? I got similar problem that type name breaks client applications when migrating from Elasticsearch library to opensearch-java library. |
@chanon-onman I am currently investigating this |
What is the bug?
The client always adds a type prefix to aggregation keys in responses which breaks compatibility with other clients or with frontend applications that directly work on aggregation responses.
This is a breaking change compared to other clients' behavior.
The Elasticsearch client API has a switch for turning off that behavior and thus returning compatible results.
See Serializing aggregations and suggestions without typed keys
How can one reproduce the bug?
Each aggregation result contains aggregation names combined as
[type]#[name]
What is the expected behavior?
There should be a compatibility setting that allows returning aggregation names without type prefix like the one provided by Elasticsearch.
What is your host/environment?
OpenSearch 2.11.0
OpenSearch Java Client 2.8.1
Java 17
Do you have any screenshots?
Do you have any additional context?
./.
The text was updated successfully, but these errors were encountered: