pandagg.node.aggs.abstract module¶
-
pandagg.node.aggs.abstract.
A
(name, type_or_agg=None, **body)[source]¶ Accept multiple syntaxes, return a AggNode instance.
Parameters: - type_or_agg –
- body –
Returns: AggNode
-
class
pandagg.node.aggs.abstract.
AggClause
(meta=None, **body)[source]¶ Bases:
pandagg.node._node.Node
Wrapper around elasticsearch aggregation concept. https://www.elastic.co/guide/en/elasticsearch/reference/2.3/search-aggregations.html
Each aggregation can be seen both a Node that can be encapsulated in a parent agg.
Define a method to build aggregation request.
-
BLACKLISTED_MAPPING_TYPES
= None¶
-
KEY
= None¶
-
VALUE_ATTRS
= None¶
-
WHITELISTED_MAPPING_TYPES
= None¶
-
get_filter
(key)[source]¶ Return filter query to list documents having this aggregation key.
Parameters: key – string Returns: elasticsearch filter query
-
line_repr
(depth, **kwargs)[source]¶ Control how node is displayed in tree representation. _ ├── one end │ └── two myEnd └── three
-
to_dict
()[source]¶ ElasticSearch aggregation queries follow this formatting:
{ "<aggregation_name>" : { "<aggregation_type>" : { <aggregation_body> } [,"meta" : { [<meta_data_body>] } ]? } }
to_dict() returns the following part (without aggregation name):
{ "<aggregation_type>" : { <aggregation_body> } [,"meta" : { [<meta_data_body>] } ]? }
-
-
class
pandagg.node.aggs.abstract.
BucketAggClause
(meta=None, **body)[source]¶ Bases:
pandagg.node.aggs.abstract.AggClause
Bucket aggregation have special abilities: they can encapsulate other aggregations as children. Each time, the extracted value is a ‘doc_count’.
Provide methods: - to build aggregation request (with children aggregations) - to to extract buckets from raw response - to build query to filter documents belonging to that bucket
Note: the aggs attribute’s only purpose is for children initiation with the following syntax: >>> from pandagg.aggs import Terms, Avg >>> agg = Terms( >>> field=’some_path’, >>> aggs={ >>> ‘avg_agg’: Avg(field=’some_other_path’) >>> } >>> )
-
VALUE_ATTRS
= None¶
-
-
class
pandagg.node.aggs.abstract.
FieldOrScriptMetricAgg
(field=None, script=None, meta=None, **body)[source]¶ Bases:
pandagg.node.aggs.abstract.MetricAgg
Metric aggregation based on single field.
-
VALUE_ATTRS
= None¶
-
-
class
pandagg.node.aggs.abstract.
MetricAgg
(meta=None, **body)[source]¶ Bases:
pandagg.node.aggs.abstract.AggClause
Metric aggregation are aggregations providing a single bucket, with value attributes to be extracted.
-
VALUE_ATTRS
= None¶
-
-
class
pandagg.node.aggs.abstract.
MultipleBucketAgg
(keyed=None, key_path='key', meta=None, **body)[source]¶ Bases:
pandagg.node.aggs.abstract.BucketAggClause
-
IMPLICIT_KEYED
= False¶
-
VALUE_ATTRS
= None¶
-
-
class
pandagg.node.aggs.abstract.
Pipeline
(buckets_path, gap_policy=None, meta=None, **body)[source]¶ Bases:
pandagg.node.aggs.abstract.UniqueBucketAgg
-
VALUE_ATTRS
= None¶
-
-
class
pandagg.node.aggs.abstract.
Root
(meta=None, **body)[source]¶ Bases:
pandagg.node.aggs.abstract.AggClause
Not a real aggregation. Just the initial empty dict (used as lighttree.Tree root).
-
KEY
= '_root'¶
-
-
class
pandagg.node.aggs.abstract.
ScriptPipeline
(script, buckets_path, gap_policy=None, meta=None, **body)[source]¶ Bases:
pandagg.node.aggs.abstract.Pipeline
-
KEY
= None¶
-
VALUE_ATTRS
= 'value'¶
-
-
class
pandagg.node.aggs.abstract.
UniqueBucketAgg
(meta=None, **body)[source]¶ Bases:
pandagg.node.aggs.abstract.BucketAggClause
Aggregations providing a single bucket.
-
VALUE_ATTRS
= None¶
-