ejsCardinalityAggregation

A single-value metrics aggregation that calculates an approximate count of distinct values. Values can be extracted either from specific fields in the document or generated by a script.

Module

 CardinalityAggregation

CardinalityAggregation ( name )

Aggregation that calculates an approximate count of distinct values.


Parameters
name <String> The name which be used to refer to this aggregation.

Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
Objectfield(field)

Sets the field to operate on.

Objectlang(language)The script language being used.
Objectparams(p)Sets parameters that will be applied to the script. Overwrites any existing params.
ObjectprecisionThreshold(num)Allows to trade memory for accuracy, and defines a unique count below which counts are expected to be close to accurate. Above this value, counts might become a bit more fuzzy. The maximum supported value is 40000, thresholds above this number will have the same effect as a threshold of 40000. Default value depends on the number of parent aggregations that multiple create buckets (such as terms or histograms).
Objectrehash(trueFalse)Set to false to disable rehashing of values. You must have computed a hash on the client-side and stored it into your documents if you disable this.
Objectscript(scriptCode)Allows you generate or modify the terms/values using a script.
ObjectscriptFile(scriptFile)Allows you generate or modify the terms/values using a script.
ObjectscriptId(scriptId)Allows you generate or modify the terms/values using a script.
StringtoJSON()

Retrieves the internal agg object. This is typically used by internal API functions so use with caution.


Method Detail

 _type

String _type ( )
The type of ejs object. For internal use only.

Returns
the type of object

 field

Object field ( field )

Sets the field to operate on.


Parameters
field <String> a valid field name..
Returns
returns this so that calls can be chained.

 lang

Object lang ( language )
The script language being used.

Parameters
language <String> The language of the script.
Returns
returns this so that calls can be chained.

 params

Object params ( p )
Sets parameters that will be applied to the script. Overwrites any existing params.

Parameters
p <Object> An object where the keys are the parameter name and values are the parameter value.
Returns
returns this so that calls can be chained.

 precisionThreshold

Object precisionThreshold ( num )
Allows to trade memory for accuracy, and defines a unique count below which counts are expected to be close to accurate. Above this value, counts might become a bit more fuzzy. The maximum supported value is 40000, thresholds above this number will have the same effect as a threshold of 40000. Default value depends on the number of parent aggregations that multiple create buckets (such as terms or histograms).

Parameters
num <Long> The threshold value
Returns
returns this so that calls can be chained.

 rehash

Object rehash ( trueFalse )
Set to false to disable rehashing of values. You must have computed a hash on the client-side and stored it into your documents if you disable this.

Parameters
trueFalse <Boolean> set to false to disable rehashing
Returns
returns this so that calls can be chained.

 script

Object script ( scriptCode )
Allows you generate or modify the terms/values using a script.

Parameters
scriptCode <String> A valid script string to execute.
Returns
returns this so that calls can be chained.

 scriptFile

Object scriptFile ( scriptFile )
Allows you generate or modify the terms/values using a script.

Parameters
scriptFile <String> A valid script file to execute.
Returns
returns this so that calls can be chained.

 scriptId

Object scriptId ( scriptId )
Allows you generate or modify the terms/values using a script.

Parameters
scriptId <String> A valid script id to execute.
Returns
returns this so that calls can be chained.

 toJSON

String toJSON ( )

Retrieves the internal agg object. This is typically used by internal API functions so use with caution.


Returns
returns this object's internal object.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo