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
I'm trying to output an AggregateDictionary to the end-user browser as JSON. When I do this, all of the properties of the object seem to be at their default state (nulls, 0s, Items are just empty JSON objects instead of IBuckets, etc).
How can one reproduce the bug?
I'm doing a simple Terms based aggregate request in my query:
new AggregationDictionary(){["DiscussionTypes"]=new AggregationContainer
{Terms=new TermsAggregation("CommunityTypeId"){Field="CommunityTypeId",Size=1000}}}
The JSON coming back from OpenSearch makes sense to me:
Then I return the Aggregations property from the ISearchResponse that I get back from the OpenSearch client to the client, something I do with C# objects all the time in my web app, and it comes out looking like this below. Notice that there are 11 empty Items objects, matching the 11 results in the JSON data above.
Typically when I see behavior like this in my own code, it's because I've over-zealously put a [JsonIgnore] on a property, or have the property defined with a private set. Is that possibly the problem here within the OS code base?
What is the expected behavior?
Outputting an AggregateDictionary should export all of the public fields via JSON.
What is your host/environment?
OpenSearch.Client 1.4.0 connected to OpenSearch 2.7 running in AWS OpenSearch Service (also tried it with Client 1.3.0 and OpenSearch 2.5).
The text was updated successfully, but these errors were encountered:
Hi @winzig, this is not exactly a bug as the types within the client are not written with the intention or expectation of being (de)serializable outside of the client. This would not be feasible to implement or maintain due to the extent of the client and differing behaviours between the various potential JSON implementations (Newtonsoft, System.Text, Utf8Json, etc).
I think it would be useful if you could provide a bit more information about your usecase. There are mechanisms to get the raw json response or a dynamic object with the low-level client if you're not planning on doing much manipulation in C#.
What is the bug?
I'm trying to output an AggregateDictionary to the end-user browser as JSON. When I do this, all of the properties of the object seem to be at their default state (nulls,
0
s,Items
are just empty JSON objects instead of IBuckets, etc).How can one reproduce the bug?
I'm doing a simple Terms based aggregate request in my query:
The JSON coming back from OpenSearch makes sense to me:
Then I return the
Aggregations
property from theISearchResponse
that I get back from the OpenSearch client to the client, something I do with C# objects all the time in my web app, and it comes out looking like this below. Notice that there are 11 emptyItems
objects, matching the 11 results in the JSON data above.Typically when I see behavior like this in my own code, it's because I've over-zealously put a
[JsonIgnore]
on a property, or have the property defined with aprivate set
. Is that possibly the problem here within the OS code base?What is the expected behavior?
Outputting an AggregateDictionary should export all of the public fields via JSON.
What is your host/environment?
OpenSearch.Client 1.4.0 connected to OpenSearch 2.7 running in AWS OpenSearch Service (also tried it with Client 1.3.0 and OpenSearch 2.5).
The text was updated successfully, but these errors were encountered: