ejsInnerHits

Inner hits can be used by defining a inner_hits definition on a nested, has_child or has_parent query and filter. This feature returns per search hit in the search response additional nested hits that caused a search hit to match in a different scope.

See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-inner-hits.html

Module

 InnerHits

InnerHits ( )

Include additional nested hits in the response.


Method Summary

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

Enable/Disable explanation of score for each hit.

ObjectfieldDataFields(Fields)

Allows to return the field data representation of a field for each hit.

Objectfrom(from)

The offset from where the first hit to fetch in the returned regular search hits.

Objecthighlight(h)

Performs highlighting based on the Highlight settings.

Objectname(name)

The name to be used for the particular inner hit definition in the response. Useful when multiple inner hits have been defined in a single search request. The default depends in which query the inner hit is defined. For has_child query and filter this is the child type, has_parent query and filter this is the parent type and the nested query and filter this is the nested path..

ObjectscriptField(oScriptField)

Computes a document property dynamically based on the supplied ScriptField.

Objectsize(size)

The maximum number of hits to return. By default the top three matching hits are returned.

Objectsort(sort)

How the inner hits should be sorted. By default the hits are sorted by the score.

Objectsource(includes,excludes)

Allows to control how the _source field is returned with every hit. By default operations return the contents of the _source field unless you have used the fields parameter or if the _source field is disabled. Set the includes parameter to false to completely disable returning the source field.

StringtoJSON()Retrieves the internal script object. This is typically used by internal API functions so use with caution.
Objectversion(trueFalse)

Enable/Disable returning version number for each hit.


Method Detail

 _type

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

Returns
the type of object

 explain

Object explain ( trueFalse )

Enable/Disable explanation of score for each hit.


Parameters
trueFalse <Boolean> true to enable, false to disable
Returns
returns this so that calls can be chained.

 fieldDataFields

Object fieldDataFields ( Fields )

Allows to return the field data representation of a field for each hit.


Parameters
Fields <Array> to return field data representation for.
Returns
returns this so that calls can be chained.

 from

Object from ( from )

The offset from where the first hit to fetch in the returned regular search hits.


Parameters
from <Integer> The offset from the first result you want to fetch.
Returns
returns this so that calls can be chained.

 highlight

Object highlight ( h )

Performs highlighting based on the Highlight settings.


Parameters
h <Highlight> A valid Highlight object
Returns
returns this so that calls can be chained.

 name

Object name ( name )

The name to be used for the particular inner hit definition in the response. Useful when multiple inner hits have been defined in a single search request. The default depends in which query the inner hit is defined. For has_child query and filter this is the child type, has_parent query and filter this is the parent type and the nested query and filter this is the nested path..


Parameters
name <String> The name to be used for the inner hit definition.
Returns
returns this so that calls can be chained.

 scriptField

Object scriptField ( oScriptField )

Computes a document property dynamically based on the supplied ScriptField.


Parameters
oScriptField <ScriptField> A valid ScriptField.
Returns
returns this so that calls can be chained.

 size

Object size ( size )

The maximum number of hits to return. By default the top three matching hits are returned.


Parameters
size <Integer> The numer of hits to be returned.
Returns
returns this so that calls can be chained.

 sort

Object sort ( sort )

How the inner hits should be sorted. By default the hits are sorted by the score.


Parameters
sort <String> The field to be sorted on.
Returns
returns this so that calls can be chained.

 source

Object source ( includes, excludes )

Allows to control how the _source field is returned with every hit. By default operations return the contents of the _source field unless you have used the fields parameter or if the _source field is disabled. Set the includes parameter to false to completely disable returning the source field.


Parameters
includes <String | Boolean | String[]> The field or list of fields to include as array. Set to a boolean false to disable the source completely.
excludes <String | String[]> The optional field or list of fields to exclude.
Returns
returns this so that calls can be chained.

 toJSON

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

Returns
returns this object's internal object representation.

 version

Object version ( trueFalse )

Enable/Disable returning version number for each hit.


Parameters
trueFalse <Boolean> true to enable, false to disable
Returns
returns this so that calls can be chained.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo