Open kpsherva opened 4 years ago
implement filters when no key in the aggregation response (has_files):
aggregations: { access: { buckets: [ { doc_count: 18, key: 0, key_as_string: "false" }, { doc_count: 12, key: 1, key_as_string: "true" } ], doc_count_error_upper_bound: 0, sum_other_doc_count: 0 }, has_files: { buckets: { has_files: { doc_count: 1 }, no_files: { doc_count: 29 } } } }
the filter defined as:
eitems=dict( aggs=dict( access=dict(terms=dict(field="open_access")), has_files=dict( filters=dict( filters=dict( has_files=dict(exists=dict(field="files.file_id")), no_files=dict( bool=dict( must_not=dict( exists=dict(field="files.file_id") ) ) ), ) ) ) ), post_filters=dict( access=terms_filter("open_access"), has_files=not_empty_object_or_list_filter("files.file_id") ) ),
ES documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filters-aggregation.html
based on this documentation rename BucketAggregation component to BucketTermAggregation and create BucketFilterAggregation to reflect the behaviour of elasticsearch
BucketAggregation
BucketTermAggregation
BucketFilterAggregation
implement filters when no key in the aggregation response (has_files):
the filter defined as:
ES documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filters-aggregation.html
based on this documentation rename
BucketAggregation
component toBucketTermAggregation
and createBucketFilterAggregation
to reflect the behaviour of elasticsearch