Skip to content

Aggregation Filter does not accept raw  #1566

Closed
@Nican

Description

@Nican

Hello! I have hit a bug with using FilterAggregator inside of a AggregationContainer. When applying a raw FilterDescription, the resulting json does not appear inside of the request.

I have the following code:

            var searchRequest = new SearchRequest()
            {
                Aggregations = new Dictionary<string, IAggregationContainer>(),
            };

            var filterContainer = new AggregationContainer()
            {
                Filter = new FilterAggregator
                {
                    Filter = new FilterDescriptor<dynamic>().Raw(@"{""test"":""test""")
                },
                Aggregations = new Dictionary<string, IAggregationContainer>()
            };

            searchRequest.Aggregations["base_filter"] = filterContainer;
            var response = esClient.Search<dynamic>(searchRequest);

And this is the request generated by NEST:

{
  "aggs": {
    "base_filter": {
      "filter": {},
      "aggs": {}
    }
  }
}

As you can see, the {"test":"test"} from the FilterDescriptor does not appear inside of the request. Is there something that I am missing?

I am using Elasticsearch.Net 1.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions