File tree 2 files changed +35
-0
lines changed
2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,10 @@ class AutoDateHistogram(DateHistogram):
197
197
name = "auto_date_histogram"
198
198
199
199
200
+ class AdjacencyMatrix (Bucket ):
201
+ name = "adjacency_matrix"
202
+
203
+
200
204
class DateRange (Bucket ):
201
205
name = "date_range"
202
206
@@ -385,6 +389,10 @@ class Sum(Agg):
385
389
name = "sum"
386
390
387
391
392
+ class TopMetrics (Agg ):
393
+ name = "top_metrics"
394
+
395
+
388
396
class TTest (Agg ):
389
397
name = "t_test"
390
398
Original file line number Diff line number Diff line change @@ -449,3 +449,30 @@ def test_random_sampler_aggregation():
449
449
},
450
450
},
451
451
} == a .to_dict ()
452
+
453
+
454
+ def test_adjancecy_matrix_aggregation ():
455
+ a = aggs .AdjacencyMatrix (
456
+ filters = {
457
+ "grpA" : {"terms" : {"accounts" : ["hillary" , "sidney" ]}},
458
+ "grpB" : {"terms" : {"accounts" : ["donald" , "mitt" ]}},
459
+ "grpC" : {"terms" : {"accounts" : ["vladimir" , "nigel" ]}},
460
+ }
461
+ )
462
+ assert {
463
+ "adjacency_matrix" : {
464
+ "filters" : {
465
+ "grpA" : {"terms" : {"accounts" : ["hillary" , "sidney" ]}},
466
+ "grpB" : {"terms" : {"accounts" : ["donald" , "mitt" ]}},
467
+ "grpC" : {"terms" : {"accounts" : ["vladimir" , "nigel" ]}},
468
+ }
469
+ }
470
+ } == a .to_dict ()
471
+
472
+
473
+ def test_top_metrics_aggregation ():
474
+ a = aggs .TopMetrics (metrics = {"field" : "m" }, sort = {"s" : "desc" })
475
+
476
+ assert {
477
+ "top_metrics" : {"metrics" : {"field" : "m" }, "sort" : {"s" : "desc" }}
478
+ } == a .to_dict ()
You can’t perform that action at this time.
0 commit comments