elastic_query_builder/aggregation/
mod.rs1pub mod cardinality_aggregation;
2pub mod filter_aggregation;
3pub mod max_aggregation;
4pub mod min_aggregation;
5pub mod multi_terms_aggregation;
6pub mod nested_aggregation;
7pub mod stats_aggregation;
8pub mod sum_aggregation;
9pub mod terms_aggregation;
10pub mod top_hits_aggregation;
11pub mod value_count_aggregation;
12pub mod reverse_nested_aggregation;
13
14use crate::aggregation::cardinality_aggregation::CardinalityAggregation;
15use crate::aggregation::filter_aggregation::FilterAggregation;
16use crate::aggregation::max_aggregation::MaxAggregation;
17use crate::aggregation::min_aggregation::MinAggregation;
18use crate::aggregation::multi_terms_aggregation::MultiTermsAggregation;
19use crate::aggregation::nested_aggregation::NestedAggregation;
20use crate::aggregation::stats_aggregation::StatsAggregation;
21use crate::aggregation::sum_aggregation::SumAggregation;
22use crate::aggregation::terms_aggregation::TermsAggregation;
23use crate::aggregation::top_hits_aggregation::TopHitsAggregation;
24use serde_json::Value;
25
26pub trait AggregationTrait {
27 fn name(&self) -> &str;
28 fn build(&self) -> Value;
29 fn query_name(&self) -> String;
30}
31
32pub struct Aggregation {}
33
34impl Aggregation {
35 pub fn terms(name: &str) -> TermsAggregation {
36 TermsAggregation::new(name)
37 }
38 pub fn cardinality(name: &str) -> CardinalityAggregation {
39 CardinalityAggregation::new(name)
40 }
41 pub fn multi_terms(name: &str) -> MultiTermsAggregation {
42 MultiTermsAggregation::new(name)
43 }
44 pub fn top_hits(name: &str) -> TopHitsAggregation {
45 TopHitsAggregation::new(name)
46 }
47 pub fn sum(name: &str) -> SumAggregation {
48 SumAggregation::new(name)
49 }
50 pub fn stats(name: &str) -> StatsAggregation {
51 StatsAggregation::new(name)
52 }
53 pub fn max(name: &str) -> MaxAggregation {
54 MaxAggregation::new(name)
55 }
56 pub fn min(name: &str) -> MinAggregation {
57 MinAggregation::new(name)
58 }
59 pub fn nested(name: &str) -> NestedAggregation {
60 NestedAggregation::new(name)
61 }
62 pub fn filter(name: &str) -> FilterAggregation {
63 FilterAggregation::new(name)
64 }
65}