elasticsearch - NEST API - Implement Pagination for Terms aggregation -
i trying implement paging fetch results in chunk terms aggregation result. seems terms aggregation not support 'from(..)' method.
below elastic search query in nest -
isearchresponse<dynamic> bresponse = objelasticclient.search<dynamic>(s => s .filter(fquery) .size(10) .index(elastic_indexname) .source(false) .alltypes() .aggregations(a => .terms(agggroupbycdminvoiceid, t => t .field("cdm_invoice_id") .size(100) .aggregations(inneragg => inneragg .tophits(agglatestdocversion, th => th .size(1) .source(false) .sort(x => x.onfield("version").descending()) ) ) ) ) );
i have set size 100 terms aggregation , implementing paging. terms aggregation not accept 'from(..)' method.
is there alternate solution?
thanks, sameer
maybe order terms differently , page filtering on index?
as per documentation:
change ordering:
{ "aggs" : { "genders" : { "terms" : { "field" : "gender", "order" : { "_term" : "asc" } } } } }
and filter:
{ "aggs" : { "tags" : { "terms" : { "field" : "tags", "include" : ".*sport.*", "exclude" : "water_.*" } } } }
alternatively reverse order , use min_doc_count doc count previous result paging:
{ "aggs" : { "tags" : { "terms" : { "field" : "tags", "min_doc_count": 10 } } } }
Comments
Post a Comment