Skip to content
Nathan Cooke edited this page Jan 3, 2019 · 1 revision

Classes

Functions

Aggregation

Base elastic aggregation.

link

Kind: global class
Todo:: Add script option.

new Aggregation(type, [field], [respectPostFilter])

Param Type Default Description
type string Aggregation type, ex: "geo_bounds";
[field] string Set the aggregation field. Commonly used in simple aggs such as min or max.
[respectPostFilter] boolean false flag to respect any post_filters by applying the filter to the aggregation. Defaults to false.

aggregation.addAggregation(aggObject, [aggName])

Adds an Elasticsearch Aggregation object to the aggregation. Used to do aggregation on multiple items.

Kind: instance method of Aggregation

Param Type Description
aggObject Aggregation Instance of Aggregation object.
[aggName] string Name of aggregation - optional.

aggregation.setName(name)

Attach a name to the aggregation object. Can be used when attaching the aggregation to a query. Convenience method to allow responsibility of the name to be given to the creator of the aggregation object. Can be accessed directly but won't show up during serialization.

Kind: instance method of Aggregation

Param Type Description
name string Name of aggregation.

aggregation.getName() ⇒ string

Get the name of the aggregation object. Returns undefined if not set.

Kind: instance method of Aggregation
Returns: string - Name of aggregation.

CardinalityAgg ⇐ Aggregation

Elastic metrics aggregation that calculates an approximate count of distinct values for a field.

link

Kind: global class
Extends: Aggregation

new CardinalityAgg(field, [respectPostFilter])

Param Type Default Description
field string Name of field to aggregate on.
[respectPostFilter] boolean false flag to respect any post_filters by applying the filter to the aggregation. Defaults to false.

cardinalityAgg.getName() ⇒ string

Get the name of the aggregation object. Defaults to '{{field}}Cardinality'

Kind: instance method of CardinalityAgg
Overrides: getName
Returns: string - Name of aggregation.

cardinalityAgg.addAggregation(aggObject, [aggName])

Adds an Elasticsearch Aggregation object to the aggregation. Used to do aggregation on multiple items.

Kind: instance method of CardinalityAgg

Param Type Description
aggObject Aggregation Instance of Aggregation object.
[aggName] string Name of aggregation - optional.

cardinalityAgg.setName(name)

Attach a name to the aggregation object. Can be used when attaching the aggregation to a query. Convenience method to allow responsibility of the name to be given to the creator of the aggregation object. Can be accessed directly but won't show up during serialization.

Kind: instance method of CardinalityAgg

Param Type Description
name string Name of aggregation.

DateHistogramAgg ⇐ Aggregation

Elastic multi-bucket aggregation that groups by dates.

link

Kind: global class
Extends: Aggregation

new DateHistogramAgg(field, interval, format, [respectPostFilter])

Param Type Default Description
field string Name of field to aggregate on.
interval string One of: year, quarter, month, week, day, hour, minute, or second
format string Date format pattern link
[respectPostFilter] false flag to respect any post_filters by applying the filter to the aggregation. Defaults to false.

dateHistogramAgg.getName() ⇒ string

Get the name of the aggregation object.

Kind: instance method of DateHistogramAgg
Overrides: getName
Returns: string - Name of aggregation. Defaults to '{{field}}DateHistogram'

dateHistogramAgg.addAggregation(aggObject, [aggName])

Adds an Elasticsearch Aggregation object to the aggregation. Used to do aggregation on multiple items.

Kind: instance method of DateHistogramAgg

Param Type Description
aggObject Aggregation Instance of Aggregation object.
[aggName] string Name of aggregation - optional.

dateHistogramAgg.setName(name)

Attach a name to the aggregation object. Can be used when attaching the aggregation to a query. Convenience method to allow responsibility of the name to be given to the creator of the aggregation object. Can be accessed directly but won't show up during serialization.

Kind: instance method of DateHistogramAgg

Param Type Description
name string Name of aggregation.

FilteredAgg ⇐ Aggregation

Elastic Filtered Aggregation.

link

Kind: global class
Extends: Aggregation
Todo:: Inherit from Aggregation using node util when prototype funcs needed.

new FilteredAgg(innerAgg, innerFilter, [innerAggName])

Param Type Description
innerAgg Aggregation Aggregation object to be filtered.
innerFilter Filter | Object Filter object to apply to the innerAgg.
[innerAggName] string innerAgg name. Defaults to filteredAggName.

filteredAgg.getName() ⇒ string

Get the name of the aggregation object.

Kind: instance method of FilteredAgg
Overrides: getName
Returns: string - Name of aggregation. Defers to innerAgg object.

filteredAgg.addAggregation(aggObject, [aggName])

Adds an Elasticsearch Aggregation object to the aggregation. Used to do aggregation on multiple items.

Kind: instance method of FilteredAgg

Param Type Description
aggObject Aggregation Instance of Aggregation object.
[aggName] string Name of aggregation - optional.

filteredAgg.setName(name)

Attach a name to the aggregation object. Can be used when attaching the aggregation to a query. Convenience method to allow responsibility of the name to be given to the creator of the aggregation object. Can be accessed directly but won't show up during serialization.

Kind: instance method of FilteredAgg

Param Type Description
name string Name of aggregation.

GeoDistanceAgg ⇐ Aggregation

Elastic Geo Distance Aggregation.

link

Kind: global class
Extends: Aggregation
Todo:: Optionally pass in "ranges" array directly or provide 2 methods.

new GeoDistanceAgg(field, origin, unit, rings, ringRadiusInterval, [respectPostFilter])

Param Type Default Description
field string Name of term to aggregate on.
origin Array.<number> | string Elasticsearch geo_point type. {PS: Lat, Lon if string, [Lon, Lat] if array.}
unit string Elasticsearch geo distance unit. @default 'm'
rings int Number of concentric distance rings to bucket by.
ringRadiusInterval number For each concetric ring, increase radius but this many units.
[respectPostFilter] false flag to respect any post_filters by applying the filter to the aggregation. Defaults to false.

geoDistanceAgg.getName() ⇒ string

Get the name of the aggregation object.

Kind: instance method of GeoDistanceAgg
Overrides: getName
Returns: string - Name of aggregation. Defaults to '{{field}}GeoDistance'

geoDistanceAgg.addAggregation(aggObject, [aggName])

Adds an Elasticsearch Aggregation object to the aggregation. Used to do aggregation on multiple items.

Kind: instance method of GeoDistanceAgg

Param Type Description
aggObject Aggregation Instance of Aggregation object.
[aggName] string Name of aggregation - optional.

geoDistanceAgg.setName(name)

Attach a name to the aggregation object. Can be used when attaching the aggregation to a query. Convenience method to allow responsibility of the name to be given to the creator of the aggregation object. Can be accessed directly but won't show up during serialization.

Kind: instance method of GeoDistanceAgg

Param Type Description
name string Name of aggregation.

MaxAgg ⇐ Aggregation

Elastic metrics aggregation that calculates the max value for the field.

link

Kind: global class
Extends: Aggregation

new MaxAgg(field, [respectPostFilter])

Param Type Default Description
field string Name of field to aggregate on.
[respectPostFilter] false flag to respect any post_filters by applying the filter to the aggregation. Defaults to false.

maxAgg.getName() ⇒ string

Get the name of the aggregation object.

Kind: instance method of MaxAgg
Overrides: getName
Returns: string - Name of aggregation. Default to '{{field}}Max'

maxAgg.addAggregation(aggObject, [aggName])

Adds an Elasticsearch Aggregation object to the aggregation. Used to do aggregation on multiple items.

Kind: instance method of MaxAgg

Param Type Description
aggObject Aggregation Instance of Aggregation object.
[aggName] string Name of aggregation - optional.

maxAgg.setName(name)

Attach a name to the aggregation object. Can be used when attaching the aggregation to a query. Convenience method to allow responsibility of the name to be given to the creator of the aggregation object. Can be accessed directly but won't show up during serialization.

Kind: instance method of MaxAgg

Param Type Description
name string Name of aggregation.

NestedAgg ⇐ Aggregation

Elastic Nested Aggregation. Wraps other aggregation instances.

Structure works around this issue

{nested: { path: 'pathstring' }, aggs: { 'innerAggName': { AGGREGATION } }}

link

Kind: global class
Extends: Aggregation
Todo:: allow multiple 'this.aggs'

new NestedAgg(innerAgg, nestPath, [innerAggName], [respectPostFilter])

Param Type Default Description
innerAgg Aggregation Inner aggregation object.
nestPath string @optional path of nested document fields. If not provided, expects innerAgg to have a 'field' property and will infer. Ex: innerAgg field='x.y.z', path will be 'x.y'.
[innerAggName] string @optional Aggregation name for inner agg.
[respectPostFilter] false flag to respect any post_filters by applying the filter to the aggregation. Defaults to false.

nestedAgg.getName() ⇒ string

Get the name of the aggregation object.

Kind: instance method of NestedAgg
Overrides: getName
Returns: string - Name of aggregation. Defers to innerAgg object.

nestedAgg.addAggregation(aggObject, [aggName])

Adds an Elasticsearch Aggregation object to the aggregation. Used to do aggregation on multiple items.

Kind: instance method of NestedAgg

Param Type Description
aggObject Aggregation Instance of Aggregation object.
[aggName] string Name of aggregation - optional.

nestedAgg.setName(name)

Attach a name to the aggregation object. Can be used when attaching the aggregation to a query. Convenience method to allow responsibility of the name to be given to the creator of the aggregation object. Can be accessed directly but won't show up during serialization.

Kind: instance method of NestedAgg

Param Type Description
name string Name of aggregation.

RangeAgg ⇐ Aggregation

Elastic multi-bucket aggregation that groups by defined ranges.

link

Kind: global class
Extends: Aggregation

new RangeAgg(field, ranges, [respectPostFilter])

Param Type Default Description
field string Name of field to aggregate on.
ranges Array.<Object> Array of objects containing 'to' and 'from' properties for each bucket.
[respectPostFilter] false flag to respect any post_filters by applying the filter to the aggregation. Defaults to false.

rangeAgg.getName() ⇒ string

Get the name of the aggregation object.

Kind: instance method of RangeAgg
Overrides: getName
Returns: string - Name of aggregation. Default to '{{field}}Range'

rangeAgg.addAggregation(aggObject, [aggName])

Adds an Elasticsearch Aggregation object to the aggregation. Used to do aggregation on multiple items.

Kind: instance method of RangeAgg

Param Type Description
aggObject Aggregation Instance of Aggregation object.
[aggName] string Name of aggregation - optional.

rangeAgg.setName(name)

Attach a name to the aggregation object. Can be used when attaching the aggregation to a query. Convenience method to allow responsibility of the name to be given to the creator of the aggregation object. Can be accessed directly but won't show up during serialization.

Kind: instance method of RangeAgg

Param Type Description
name string Name of aggregation.

ScriptedMetricAgg ⇐ Aggregation

Elastic metrics aggregation that executes map-reduce style scripts.

link

Kind: global class
Extends: Aggregation

new ScriptedMetricAgg(scripts, [respectPostFilter])

Param Type Default Description
scripts Object Scripts object containing map-reduce logic.
[respectPostFilter] boolean false flag to respect any post_filters by applying the filter to the aggregation. Defaults to false. { 'init_script': 'script', 'map_script':'script', 'combine_script':'script', 'reduce_script':'script' }

scriptedMetricAgg.addAggregation(aggObject, [aggName])

Adds an Elasticsearch Aggregation object to the aggregation. Used to do aggregation on multiple items.

Kind: instance method of ScriptedMetricAgg

Param Type Description
aggObject Aggregation Instance of Aggregation object.
[aggName] string Name of aggregation - optional.

scriptedMetricAgg.setName(name)

Attach a name to the aggregation object. Can be used when attaching the aggregation to a query. Convenience method to allow responsibility of the name to be given to the creator of the aggregation object. Can be accessed directly but won't show up during serialization.

Kind: instance method of ScriptedMetricAgg

Param Type Description
name string Name of aggregation.

scriptedMetricAgg.getName() ⇒ string

Get the name of the aggregation object. Returns undefined if not set.

Kind: instance method of ScriptedMetricAgg
Returns: string - Name of aggregation.

TermsAgg ⇐ Aggregation

Elastic metrics aggregation that calculates an approximate count of distinct values for a field.

link

Kind: global class
Extends: Aggregation

new TermsAgg(field, [size], [respectPostFilter])

Param Type Default Description
field string Name of field to aggregate on.
[size] int Number of buckets to return. Size 0 returns all buckets.
[respectPostFilter] false flag to respect any post_filters by applying the filter to the aggregation. Defaults to false.

termsAgg.getName() ⇒ string

Get the name of the aggregation object.

Kind: instance method of TermsAgg
Overrides: getName
Returns: string - Name of aggregation. Default to '{{field}}Terms'

termsAgg.addAggregation(aggObject, [aggName])

Adds an Elasticsearch Aggregation object to the aggregation. Used to do aggregation on multiple items.

Kind: instance method of TermsAgg

Param Type Description
aggObject Aggregation Instance of Aggregation object.
[aggName] string Name of aggregation - optional.

termsAgg.setName(name)

Attach a name to the aggregation object. Can be used when attaching the aggregation to a query. Convenience method to allow responsibility of the name to be given to the creator of the aggregation object. Can be accessed directly but won't show up during serialization.

Kind: instance method of TermsAgg

Param Type Description
name string Name of aggregation.

extractField()

Gets the path to the parent object of the desired property. EX: 'w.x.y.z' returns 'w.x.y' as a string.

Kind: global function

Clone this wiki locally