pandagg.node.aggs.abstract module¶
-
class
pandagg.node.aggs.abstract.
AggNode
(name, 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. :param key: string :return: elasticsearch filter query
-
to_dict
(with_name=False)[source]¶ ElasticSearch aggregation queries follow this formatting:
{ "<aggregation_name>" : { "<aggregation_type>" : { <aggregation_body> } [,"meta" : { [<meta_data_body>] } ]? } }
Query dict returns the following part (without aggregation name):
{ "<aggregation_type>" : { <aggregation_body> } [,"meta" : { [<meta_data_body>] } ]? }
-
-
class
pandagg.node.aggs.abstract.
BucketAggNode
(name, meta=None, **body)[source]¶ Bases:
pandagg.node.aggs.abstract.AggNode
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( >>> name=’term_agg’, >>> field=’some_path’, >>> aggs=[ >>> Avg(agg_name=’avg_agg’, field=’some_other_path’) >>> ] >>> )
-
VALUE_ATTRS
= None¶
-
-
class
pandagg.node.aggs.abstract.
FieldOrScriptMetricAgg
(name, 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
(name, meta=None, **body)[source]¶ Bases:
pandagg.node.aggs.abstract.AggNode
Metric aggregation are aggregations providing a single bucket, with value attributes to be extracted.
-
VALUE_ATTRS
= None¶
-
-
class
pandagg.node.aggs.abstract.
MultipleBucketAgg
(name, keyed=None, key_path='key', meta=None, **body)[source]¶ Bases:
pandagg.node.aggs.abstract.BucketAggNode
-
IMPLICIT_KEYED
= False¶
-
VALUE_ATTRS
= None¶
-
-
class
pandagg.node.aggs.abstract.
Pipeline
(name, buckets_path, gap_policy=None, meta=None, **body)[source]¶ Bases:
pandagg.node.aggs.abstract.UniqueBucketAgg
-
VALUE_ATTRS
= None¶
-
-
class
pandagg.node.aggs.abstract.
ScriptPipeline
(name, 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.
ShadowRoot
[source]¶ Bases:
pandagg.node.aggs.abstract.UniqueBucketAgg
Not a real aggregation.
-
KEY
= 'shadow_root'¶
-
-
class
pandagg.node.aggs.abstract.
UniqueBucketAgg
(name, meta=None, **body)[source]¶ Bases:
pandagg.node.aggs.abstract.BucketAggNode
Aggregations providing a single bucket.
-
VALUE_ATTRS
= None¶
-