File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ def __getitem__(self, agg_name: str) -> Agg[_R]:
127
127
# make sure we're not mutating a shared state - whenever accessing a
128
128
# bucket, return a shallow copy of it to be safe
129
129
if isinstance (agg , Bucket ):
130
- agg = A (agg .name , filter = None , ** agg ._params )
130
+ agg = A (agg .name , ** agg ._params )
131
131
# be sure to store the copy so any modifications to it will affect us
132
132
self ._params ["aggs" ][agg_name ] = agg
133
133
Original file line number Diff line number Diff line change @@ -476,3 +476,12 @@ def test_top_metrics_aggregation() -> None:
476
476
assert {
477
477
"top_metrics" : {"metrics" : {"field" : "m" }, "sort" : {"s" : "desc" }}
478
478
} == a .to_dict ()
479
+
480
+
481
+ def test_bucket_agg_with_filter () -> None :
482
+ b = aggs .Filter (query .Terms (something = [1 , 2 , 3 ]))
483
+
484
+ a = aggs .Terms (field = "some_field" , size = 100 )
485
+ a .bucket ("b" , b )
486
+
487
+ assert a .aggs ["b" ] == a ["b" ] # a['b'] threw exception before patch #1902
You can’t perform that action at this time.
0 commit comments