ejsHistogramAggregation

A multi-bucket values source based aggregation that can be applied on numeric values extracted from the documents. It dynamically builds fixed size (a.k.a. interval) buckets over the values.

Module

 HistogramAggregation

HistogramAggregation ( name )

Aggregation that can be applied on numeric values extracted from the documents.


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.
Objectagg(agg)Add a nesated aggregation. This method can be called multiple times in order to set multiple nested aggregations what will be executed at the same time as the parent aggregation. Alias for the aggregation method.
Objectaggregation(agg)Add a nesated aggregation. This method can be called multiple times in order to set multiple nested aggregations what will be executed at the same time as the parent aggregation.
ObjectextendedBounds(min,max)Set's the range/bounds for the histogram aggregation. Useful when you want to include buckets that might be outside the bounds of indexed documents.
Objectfield(field)

Sets the field to operate on.

Objectformat(f)Sets the format expression for the terms. Use for number or date formatting
Objectinterval(i)Sets the histogram interval. Buckets are generated based on this interval value.
Objectkeyed(trueFalse)Enable the response to be returned as a keyed object where the key is the bucket interval.
Objectlang(language)The script language being used.
ObjectminDocCount(num)Only return terms that match more than a configured number of hits.
Objectorder(order,direction)Sets order for the aggregated values.
Objectparams(p)Sets parameters that will be applied to the script. Overwrites any existing params.
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

 agg

Object agg ( agg )
Add a nesated aggregation. This method can be called multiple times in order to set multiple nested aggregations what will be executed at the same time as the parent aggregation. Alias for the aggregation method.

Parameters
agg <Aggregation> Any valid Aggregation object.
Returns
returns this so that calls can be chained.

 aggregation

Object aggregation ( agg )
Add a nesated aggregation. This method can be called multiple times in order to set multiple nested aggregations what will be executed at the same time as the parent aggregation.

Parameters
agg <Aggregation> Any valid Aggregation object.
Returns
returns this so that calls can be chained.

 extendedBounds

Object extendedBounds ( min, max )
Set's the range/bounds for the histogram aggregation. Useful when you want to include buckets that might be outside the bounds of indexed documents.

Parameters
min <Long> The start bound / minimum bound value
max <Long> The end bound / maximum bound value
Returns
returns this so that calls can be chained.

 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.

 format

Object format ( f )
Sets the format expression for the terms. Use for number or date formatting

Parameters
f <String> the format string
Returns
returns this so that calls can be chained.

 interval

Object interval ( i )
Sets the histogram interval. Buckets are generated based on this interval value.

Parameters
i <Integer> The interval
Returns
returns this so that calls can be chained.

 keyed

Object keyed ( trueFalse )
Enable the response to be returned as a keyed object where the key is the bucket interval.

Parameters
trueFalse <Boolean> to enable keyed response or not
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.

 minDocCount

Object minDocCount ( num )
Only return terms that match more than a configured number of hits.

Parameters
num <Integer> The numer of minimum number of hits.
Returns
returns this so that calls can be chained.

 order

Object order ( order, direction )
Sets order for the aggregated values.

Parameters
order <String> The order string.
direction <String> The sort direction, asc or desc.
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.

 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