c# - Nest aggregation not working correctly -
i have use case need aggregation on multiple columns using c#. using nest libraries , facing following issue
query c# :
var searchrequest = new searchrequest { searchtype = searchtype.count, filter = filter, aggregations = new dictionary<string, iaggregationcontainer> { { "a", new aggregationcontainer { extendedstats = new extendedstatsaggregator() { field = "a" } } }, { "b", new aggregationcontainer { extendedstats = new extendedstatsaggregator() { field = "b" } } } } };
when receive response nest, getting result 1 aggregation. looking @ searchresult.agg dictionary has 1 entry 1 aggregation field instead of two. let me know if missing soemthing or issue nest libraries
if using term aggregation need use aggregation filter.
var qryres1 = client.search<object>(x => x .aggregations(ag => ag .filter("filter", (flt => flt .filter(f => { filtercontainer filter = null; filter &= f.query(qr => qr.term(wl => wl.onfield("a").value("the value need filter field a"))); return filter; }) .aggregations(agr => agr .terms("b", tr => { termsaggregationdescriptor<object> trmaggdescriptor = new termsaggregationdescriptor<object>(); trmaggdescriptor.field("b"); return trmaggdescriptor; })))) )); var terms = qryres1.aggs.filter("filter").terms("b");
Comments
Post a Comment