Skip to content

Aggregation Filter does not accept raw #1566

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

Closed
Nican opened this issue Sep 18, 2015 · 3 comments
Closed

Aggregation Filter does not accept raw #1566

Nican opened this issue Sep 18, 2015 · 3 comments

Comments

@Nican
Copy link

Nican commented Sep 18, 2015

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

@Mpdreamz
Copy link
Member

Hi Nican,

We found that not all properties that take a Filter/QueryContainer were decorated with something we are working on rectifying in 2.0 with a unit tests to assert all QueryContainer properties have the same jsonconverters set. This is something we have to backport to 1.x

e.g:
https://github.com/elastic/elasticsearch-net/blob/develop/src/Nest/DSL/Aggregations/FilterAggregationDescriptor.cs#L11

has no dedicated [JsonConverter] attribute whereas:

https://github.com/elastic/elasticsearch-net/blob/develop/src/Nest/DSL/SearchDescriptor.cs#L86-L87

does.

@Nican
Copy link
Author

Nican commented Sep 23, 2015

Any suggestions for a quick workaround while the issue is not fixed?

EDIT: Also, thank you for the response.

@Mpdreamz Mpdreamz added the Bug label Sep 23, 2015
@gmarz gmarz added the v1.7.2 label Nov 13, 2015
Mpdreamz added a commit that referenced this issue Jan 6, 2016
…ed all jsonconverters on props of type IQueryContainer and IFilterContainer
@Mpdreamz
Copy link
Member

Mpdreamz commented Jan 6, 2016

Hi Nican,

This is now fixed on the 1.x branch as well and should make it into the next release. Sorry for taking some time to resolve this one.

@Mpdreamz Mpdreamz closed this as completed Jan 6, 2016
@gmarz gmarz removed the v1.7.2 label Jan 14, 2016
@gmarz gmarz added this to the 1.7.2 milestone Jan 14, 2016
@gmarz gmarz removed this from the 1.7.2 milestone Jan 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants