-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Elastic.Clients.Elasticsearch version: 8.19.6
Elasticsearch version: 8.18.4
.NET runtime version: .net9
Operating system version: Cloud Cluster
Description of the problem including expected versus actual behavior:
I need a way to construct the following query
{
"size": 0,
"aggs": {
"nested_metadata": {
"nested": {
"path": "AdditionalMetadata"
},
"aggs": {
"distinct_keys": {
"terms": {
"field": "AdditionalMetadata.key.keyword",
"size": 1000
}
}
}
}
}
}
I don't see a way to set the aggs
with in the nested
object. Here is what I have
var searchRequest = new SearchRequest
{
Size = 0,
Aggregations = new Dictionary<string, Aggregation>
{
{
"nested_metadata", new NestedAggregation()
{
Path = "AdditionalMetadata",
}
}
},
};
I am expecting the NestedAggregation
to have a Aggregations
property of type IDictionary<string, Aggregation>?
but I can't find it. I tried to look for anther class that could be inherited from NestedAggregation
but can't find any.
@flobernd what is the trick to set the nested aggregation using the library?