ejsHighlight

Allows to highlight search results on one or more fields. In order to perform highlighting, the actual content of the field is required. If the field in question is stored (has store set to yes in the mapping), it will be used, otherwise, the actual _source will be loaded and the relevant field will be extracted from it.

If no term_vector information is provided (by setting it to with_positions_offsets in the mapping), then the plain highlighter will be used. If it is provided, then the fast vector highlighter will be used. When term vectors are available, highlighting will be performed faster at the cost of bigger index size.

See http://www.elasticsearch.org/guide/reference/api/search/highlighting.html

Module

 Highlight

Highlight ( fields )

Allows to highlight search results on one or more fields.


Parameters
fields <String | String[]> An optional field or array of fields to highlight.

Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
ObjectboundaryChars(charStr,oField)Set's the boundary characters. When highlighting a field that is mapped with term vectors, boundary_chars can be configured to define what constitutes a boundary for highlighting. It’s a single string with each boundary character defined in it. You can apply the option to a specific field by passing the field name in to the oField parameter. It defaults to ".,!? \t\n".
ObjectboundaryMaxScan(cnt,oField)Sets the max number of characters to scan while looking for the start of a boundary character. You can apply the option to a specific field by passing the field name in to the oField parameter. Default: 20
Objectencoder(e)Sets highlight encoder. Valid values are: default - the default, no encoding html - to encode html characters if you use html tags
Objectfields(vals)Allows you to set the fields that will be highlighted. You can specify a single field or an array of fields. All fields are added to the current list of fields.
Objectfragmenter(f,oField)Sets the fragmenter type. You can apply the option to a specific field by passing the field name in to the oField parameter. Valid values for order are: simple - breaks text up into same-size fragments with no concerns over spotting sentence boundaries. span - breaks text up into same-size fragments but does not split up Spans.
ObjectfragmentSize(size,oField)Sets the size of each highlight fragment in characters. You can apply the option to a specific field by passing the field name in to the oField parameter. Default: 100
ObjecthighlightFilter(trueFalse,oField)Enables highlights in documents matched by a filter. You can apply the option to a specific field by passing the field name in to the oField parameter. Defaults to false.
ObjectnumberOfFragments(cnt,oField)Sets the number of highlight fragments. You can apply the option to a specific field by passing the field name in to the oField parameter. Default: 5
Objectoptions(opts,oField)Sets arbitrary options that can be passed to the highlighter implementation in use.
Objectorder(o,oField)Sets the order of highlight fragments. You can apply the option to a specific field by passing the field name in to the oField parameter. Valid values for order are: score - the score calculated by Lucene's highlighting framework.
ObjectpostTags(tags,oField)Sets the post tags for highlighted fragments. You can apply the tags to a specific field by passing the field name in to the oField parameter.
ObjectpreTags(tags,oField)Sets the pre tags for highlighted fragments. You can apply the tags to a specific field by passing the field name in to the oField parameter.
ObjectrequireFieldMatch(trueFalse,oField)When enabled it will cause a field to be highlighted only if a query matched that field. false means that terms are highlighted on all requested fields regardless if the query matches specifically on them. You can apply the option to a specific field by passing the field name in to the oField parameter. Defaults to false.
ObjecttagsSchema(s)Sets the schema to be used for the tags. Valid values are: styled - 10 pre tags with css class of hltN, where N is 1-10
StringtoJSON()Retrieves the internal script object. This is typically used by internal API functions so use with caution.
Objecttype(t,oField)Sets the highligher type. You can apply the option to a specific field by passing the field name in to the oField parameter. Valid values for order are: plain - the slower Lucene standard highligher postings - the postings highligher fvh - the fast vector based highligher

Method Detail

 _type

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

Returns
the type of object

 boundaryChars

Object boundaryChars ( charStr, oField )
Set's the boundary characters. When highlighting a field that is mapped with term vectors, boundary_chars can be configured to define what constitutes a boundary for highlighting. It’s a single string with each boundary character defined in it. You can apply the option to a specific field by passing the field name in to the oField parameter. It defaults to ".,!? \t\n".

Parameters
charStr <String> The boundary chars in a string.
oField <String> An optional field name
Returns
returns this so that calls can be chained.

 boundaryMaxScan

Object boundaryMaxScan ( cnt, oField )
Sets the max number of characters to scan while looking for the start of a boundary character. You can apply the option to a specific field by passing the field name in to the oField parameter. Default: 20

Parameters
cnt <Integer> The max characters to scan.
oField <String> An optional field name
Returns
returns this so that calls can be chained.

 encoder

Object encoder ( e )
Sets highlight encoder. Valid values are: default - the default, no encoding html - to encode html characters if you use html tags

Parameters
e <String> The encoder. default or html
Returns
returns this so that calls can be chained.

 fields

Object fields ( vals )
Allows you to set the fields that will be highlighted. You can specify a single field or an array of fields. All fields are added to the current list of fields.

Parameters
vals <String | String[]> A field name or array of field names.
Returns
returns this so that calls can be chained.

 fragmenter

Object fragmenter ( f, oField )
Sets the fragmenter type. You can apply the option to a specific field by passing the field name in to the oField parameter. Valid values for order are: simple - breaks text up into same-size fragments with no concerns over spotting sentence boundaries. span - breaks text up into same-size fragments but does not split up Spans.

Parameters
f <String> The fragmenter.
oField <String> An optional field name
Returns
returns this so that calls can be chained.

 fragmentSize

Object fragmentSize ( size, oField )
Sets the size of each highlight fragment in characters. You can apply the option to a specific field by passing the field name in to the oField parameter. Default: 100

Parameters
size <Integer> The fragment size in characters.
oField <String> An optional field name
Returns
returns this so that calls can be chained.

 highlightFilter

Object highlightFilter ( trueFalse, oField )
Enables highlights in documents matched by a filter. You can apply the option to a specific field by passing the field name in to the oField parameter. Defaults to false.

Parameters
trueFalse <Boolean> If filtered docs should be highlighted.
oField <String> An optional field name
Returns
returns this so that calls can be chained.

 numberOfFragments

Object numberOfFragments ( cnt, oField )
Sets the number of highlight fragments. You can apply the option to a specific field by passing the field name in to the oField parameter. Default: 5

Parameters
cnt <Integer> The fragment size in characters.
oField <String> An optional field name
Returns
returns this so that calls can be chained.

 options

Object options ( opts, oField )
Sets arbitrary options that can be passed to the highlighter implementation in use.

Since
elasticsearch 0.90.1
Parameters
opts <String> A map/object of option name and values.
oField <Object> An optional field name
Returns
returns this so that calls can be chained.

 order

Object order ( o, oField )
Sets the order of highlight fragments. You can apply the option to a specific field by passing the field name in to the oField parameter. Valid values for order are: score - the score calculated by Lucene's highlighting framework.

Parameters
o <String> The order. Currently only "score".
oField <String> An optional field name
Returns
returns this so that calls can be chained.

 postTags

Object postTags ( tags, oField )
Sets the post tags for highlighted fragments. You can apply the tags to a specific field by passing the field name in to the oField parameter.

Parameters
tags <String | String[]> A single tag or an array of tags.
oField <String> An optional field name
Returns
returns this so that calls can be chained.

 preTags

Object preTags ( tags, oField )
Sets the pre tags for highlighted fragments. You can apply the tags to a specific field by passing the field name in to the oField parameter.

Parameters
tags <String | String[]> A single tag or an array of tags.
oField <String> An optional field name
Returns
returns this so that calls can be chained.

 requireFieldMatch

Object requireFieldMatch ( trueFalse, oField )
When enabled it will cause a field to be highlighted only if a query matched that field. false means that terms are highlighted on all requested fields regardless if the query matches specifically on them. You can apply the option to a specific field by passing the field name in to the oField parameter. Defaults to false.

Parameters
trueFalse <Boolean> If filtered docs should be highlighted.
oField <String> An optional field name
Returns
returns this so that calls can be chained.

 tagsSchema

Object tagsSchema ( s )
Sets the schema to be used for the tags. Valid values are: styled - 10 pre tags with css class of hltN, where N is 1-10

Parameters
s <String> The schema. Currently only "styled".
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.

 type

Object type ( t, oField )
Sets the highligher type. You can apply the option to a specific field by passing the field name in to the oField parameter. Valid values for order are: plain - the slower Lucene standard highligher postings - the postings highligher fvh - the fast vector based highligher

Parameters
t <String> The highligher.
oField <String> An optional field name
Returns
returns this so that calls can be chained.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo