Added support for the bucket aggregation. (#797)

Signed-off-by: dblock <dblock@amazon.com>
Co-authored-by: mckirk <mckirk@posteo.de>
This commit is contained in:
Daniel (dB.) Doubrovkine
2024-08-15 10:49:58 -04:00
committed by GitHub
parent be56ae82b8
commit def00facfb
3 changed files with 17 additions and 0 deletions
+1
View File
@@ -3,6 +3,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
## [Unreleased]
### Added
- Added support for the `multi_terms` bucket aggregation ([#797](https://github.com/opensearch-project/opensearch-py/pull/797))
### Changed
- Removed deprecated `numpy.float_` and update NumPy/Pandas imports ([#762](https://github.com/opensearch-project/opensearch-py/pull/762))
- Removed workaround for [aiohttp#1769](https://github.com/aio-libs/aiohttp/issues/1769) ([#794](https://github.com/opensearch-project/opensearch-py/pull/794))
+4
View File
@@ -308,6 +308,10 @@ class VariableWidthHistogram(Bucket):
return FieldBucketData(self, search, data)
class MultiTerms(Bucket):
name = "multi_terms"
# metric aggregations
class TopHits(Agg):
name = "top_hits"
@@ -309,6 +309,18 @@ def test_variable_width_histogram_aggregation() -> None:
assert {"variable_width_histogram": {"buckets": 2, "field": "price"}} == a.to_dict()
def test_multi_terms_aggregation() -> None:
a = aggs.MultiTerms(terms=[{"field": "tags"}, {"field": "author.row"}])
assert {
"multi_terms": {
"terms": [
{"field": "tags"},
{"field": "author.row"},
]
}
} == a.to_dict()
def test_median_absolute_deviation_aggregation() -> None:
a = aggs.MedianAbsoluteDeviation(field="rating")