ejsStatisticalFacet

A statistical facet allows you to compute statistical data over a numeric fields. Statistical data includes the count, total, sum of squares, mean (average), minimum, maximum, variance, and standard deviation.

Facets are similar to SQL GROUP BY statements but perform much better. You can also construct several "groups" at once by simply specifying multiple facets.

Tip: For more information on faceted navigation, see this Wikipedia article on Faceted Classification.

Module

 StatisticalFacet

StatisticalFacet ( name )

A facet which returns statistical information about a numeric field


Parameters
name <String> The name which be used to refer to this facet. For instance, the facet itself might utilize a field named doc_authors. Setting name to Authors would allow you to refer to the facet by that name, possibly simplifying some of the display logic.

Method Summary

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

Enables caching of the facetFilter

ObjectfacetFilter(oFilter)

Allows you to reduce the documents used for computing facet results.

Objectfield(fieldName)Sets the field to be used to construct the this facet.
Objectfields(aFieldName)Aggregate statistical info across a set of fields.
Objectglobal(trueFalse)

Computes values across the entire index

Objectlang(language)The script language being used. Currently supported values are javascript, groovy, and mvel.
Objectmode(m)

Sets the mode the facet will use.

collector
post
Objectnested(path)

Sets the path to the nested document if faceting against a nested field.

Objectparams(oParams)Allows you to set script parameters to be used during the execution of the script.
Objectscope(scope)

Computes values across the the specified scope

Objectscript(code)Define a script to evaluate of which the result will be used to generate the statistical information.
StringtoJSON()

Retrieves the internal facet 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

 cacheFilter

Object cacheFilter ( trueFalse )

Enables caching of the facetFilter


Parameters
trueFalse <Boolean> If the facetFilter should be cached or not
Returns
returns this so that calls can be chained.

 facetFilter

Object facetFilter ( oFilter )

Allows you to reduce the documents used for computing facet results.


Parameters
oFilter <Object> A valid Filter object.
Returns
returns this so that calls can be chained.

 field

Object field ( fieldName )
Sets the field to be used to construct the this facet.

Parameters
fieldName <String> The field name whose data will be used to construct the facet.
Returns
returns this so that calls can be chained.

 fields

Object fields ( aFieldName )
Aggregate statistical info across a set of fields.

Parameters
aFieldName <Array> An array of field names.
Returns
returns this so that calls can be chained.

 global

Object global ( trueFalse )

Computes values across the entire index


Parameters
trueFalse <Boolean> Calculate facet counts globally or not.
Returns
returns this so that calls can be chained.

 lang

Object lang ( language )
The script language being used. Currently supported values are javascript, groovy, and mvel.

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

 mode

Object mode ( m )

Sets the mode the facet will use.

collector
post

Parameters
m <String> The mode: collector or post.
Returns
returns this so that calls can be chained.

 nested

Object nested ( path )

Sets the path to the nested document if faceting against a nested field.


Parameters
path <String> The nested path
Returns
returns this so that calls can be chained.

 params

Object params ( oParams )
Allows you to set script parameters to be used during the execution of the script.

Parameters
oParams <Object> An object containing key/value pairs representing param name/value.
Returns
returns this so that calls can be chained.

 scope

Object scope ( scope )

Computes values across the the specified scope


Deprecated
since elasticsearch 0.90
Parameters
scope <String> The scope name to calculate facet counts with.
Returns
returns this so that calls can be chained.

 script

Object script ( code )
Define a script to evaluate of which the result will be used to generate the statistical information.

Parameters
code <String> The script code to execute.
Returns
returns this so that calls can be chained.

 toJSON

String toJSON ( )

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


Returns
returns this object's internal facet property.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo