ejsTopChildrenQuery

TThe top_children query runs the child query with an estimated hits size, and out of the hit docs, aggregates it into parent docs. If there aren’t enough parent docs matching the requested from/size search request, then it is run again with a wider (more hits) search.

The top_children also provide scoring capabilities, with the ability to specify max, sum or avg as the score type.

Module

 TopChildrenQuery

TopChildrenQuery ( qry, type )
Returns child documents matching the query aggregated into the parent docs.

Parameters
qry <Object> A valid query object.
type <String> The child type to execute the query on

Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
Objectboost(boost)Sets the boost value for documents matching the Query.
Objectfactor(f)Sets the factor which is the number of hits that are asked for in the child query. Defaults to 5.
ObjectincrementalFactor(f)Sets the incremental factor. The incremental factor is used when not enough child documents are returned so the factor is multiplied by the incremental factor to fetch more results. Defaults to 52
Objectquery(q)Sets the query
Objectscope(s)Sets the scope of the query. A scope allows to run facets on the same scope name that will work against the child documents.
Objectscore(s)Sets the scoring type. Valid values are max, sum, or avg. If another value is passed it we silently ignore the value.
ObjectscoreMode(s)Sets the scoring type. Valid values are max, sum, total, or avg. If another value is passed it we silently ignore the value.
StringtoJSON()Retrieves the internal query object. This is typically used by internal API functions so use with caution.
Objecttype(t)Sets the child document type to search against

Method Detail

 _type

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

Returns
the type of object

 boost

Object boost ( boost )
Sets the boost value for documents matching the Query.

Parameters
boost <Double> A positive double value.
Returns
returns this so that calls can be chained.

 factor

Object factor ( f )
Sets the factor which is the number of hits that are asked for in the child query. Defaults to 5.

Parameters
f <Integer> A positive integer value.
Returns
returns this so that calls can be chained.

 incrementalFactor

Object incrementalFactor ( f )
Sets the incremental factor. The incremental factor is used when not enough child documents are returned so the factor is multiplied by the incremental factor to fetch more results. Defaults to 52

Parameters
f <Integer> A positive integer value.
Returns
returns this so that calls can be chained.

 query

Object query ( q )
Sets the query

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

 scope

Object scope ( s )
Sets the scope of the query. A scope allows to run facets on the same scope name that will work against the child documents.

Deprecated
since elasticsearch 0.90
Parameters
s <String> The scope name as a string.
Returns
returns this so that calls can be chained.

 score

Object score ( s )
Sets the scoring type. Valid values are max, sum, or avg. If another value is passed it we silently ignore the value.

Deprecated
since elasticsearch 0.90.1, use scoreMode
Parameters
s <String> The scoring type as a string.
Returns
returns this so that calls can be chained.

 scoreMode

Object scoreMode ( s )
Sets the scoring type. Valid values are max, sum, total, or avg. If another value is passed it we silently ignore the value.

Parameters
s <String> The scoring type as a string.
Returns
returns this so that calls can be chained.

 toJSON

String toJSON ( )
Retrieves the internal query object. This is typically used by internal API functions so use with caution.

Returns
returns this object's internal query property.

 type

Object type ( t )
Sets the child document type to search against

Parameters
t <String> A valid type name
Returns
returns this so that calls can be chained.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo