ejsTermSuggester

TermSuggester suggests terms based on edit distance. The provided suggest text is analyzed before terms are suggested. The suggested terms are provided per analyzed suggest text token. This leaves the suggest-selection to the API consumer. For a higher level suggester, please use the PhraseSuggester.

Module

 TermSuggester

TermSuggester ( name )

A suggester that suggests terms based on edit distance.


Since
elasticsearch 0.90
Parameters
name <String> The name which be used to refer to this suggester.

Method Summary

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

Sets the accuracy. How similar the suggested terms at least need to be compared to the original suggest text.

Objectanalyzer(analyzer)

Sets analyzer used to analyze the suggest text.

Objectfield(field)

Sets the field used to generate suggestions from.

ObjectmaxEdits(max)

Sets the maximum edit distance candidate suggestions can have in order to be considered as a suggestion.

ObjectmaxInspections(max)

The factor that is used to multiply with the size in order to inspect more candidate suggestions.

ObjectmaxTermFreq(max)

Sets a maximum threshold in number of documents a suggest text token can exist in order to be corrected.

ObjectminDocFreq(min)

Sets a minimal threshold of the number of documents a suggested term should appear in.

ObjectminWordLen(len)

Sets the minimum length a suggest text term must have in order to be corrected.

ObjectshardSize(s)

Sets the maximum number of suggestions to be retrieved from each individual shard.

Objectsize(s)

Sets the number of suggestions returned for each token.

Objectsort(s)

Sets the sort mode. Valid values are:

score - Sort by score first, then document frequency, and then the term itself
frequency - Sort by document frequency first, then simlarity score and then the term itself
ObjectstringDistance(s)

Sets what string distance implementation to use for comparing how similar suggested terms are. Valid values are:

internal - based on damerau_levenshtein but but highly optimized for comparing string distance for terms inside the index
damerau_levenshtein - String distance algorithm based on Damerau-Levenshtein algorithm
levenstein - String distance algorithm based on Levenstein edit distance algorithm
jarowinkler - String distance algorithm based on Jaro-Winkler algorithm
ngram - String distance algorithm based on character n-grams
ObjectsuggestMode(m)

Sets the suggest mode. Valid values are:

missing - Only suggest terms in the suggest text that aren't in the index
popular - Only suggest suggestions that occur in more docs then the original suggest text term
always - Suggest any matching suggestions based on terms in the suggest text
Objecttext(txt)

Sets the text to get suggestions for. If not set, the global suggestion text will be used.

StringtoJSON()

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

 accuracy

Object accuracy ( a )

Sets the accuracy. How similar the suggested terms at least need to be compared to the original suggest text.


Parameters
a <Double> A positive double value between 0 and 1.
Returns
returns this so that calls can be chained.

 analyzer

Object analyzer ( analyzer )

Sets analyzer used to analyze the suggest text.


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

 field

Object field ( field )

Sets the field used to generate suggestions from.


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

 maxEdits

Object maxEdits ( max )

Sets the maximum edit distance candidate suggestions can have in order to be considered as a suggestion.


Parameters
max <Integer> An integer value greater than 0.
Returns
returns this so that calls can be chained.

 maxInspections

Object maxInspections ( max )

The factor that is used to multiply with the size in order to inspect more candidate suggestions.


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

 maxTermFreq

Object maxTermFreq ( max )

Sets a maximum threshold in number of documents a suggest text token can exist in order to be corrected.


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

 minDocFreq

Object minDocFreq ( min )

Sets a minimal threshold of the number of documents a suggested term should appear in.


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

 minWordLen

Object minWordLen ( len )

Sets the minimum length a suggest text term must have in order to be corrected.


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

 shardSize

Object shardSize ( s )

Sets the maximum number of suggestions to be retrieved from each individual shard.


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

 size

Object size ( s )

Sets the number of suggestions returned for each token.


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

 sort

Object sort ( s )

Sets the sort mode. Valid values are:

score - Sort by score first, then document frequency, and then the term itself
frequency - Sort by document frequency first, then simlarity score and then the term itself

Parameters
s <String> The score type of score or frequency.
Returns
returns this so that calls can be chained.

 stringDistance

Object stringDistance ( s )

Sets what string distance implementation to use for comparing how similar suggested terms are. Valid values are:

internal - based on damerau_levenshtein but but highly optimized for comparing string distance for terms inside the index
damerau_levenshtein - String distance algorithm based on Damerau-Levenshtein algorithm
levenstein - String distance algorithm based on Levenstein edit distance algorithm
jarowinkler - String distance algorithm based on Jaro-Winkler algorithm
ngram - String distance algorithm based on character n-grams

Parameters
s <String> The string distance algorithm name.
Returns
returns this so that calls can be chained.

 suggestMode

Object suggestMode ( m )

Sets the suggest mode. Valid values are:

missing - Only suggest terms in the suggest text that aren't in the index
popular - Only suggest suggestions that occur in more docs then the original suggest text term
always - Suggest any matching suggestions based on terms in the suggest text

Parameters
m <String> The mode of missing, popular, or always.
Returns
returns this so that calls can be chained.

 text

Object text ( txt )

Sets the text to get suggestions for. If not set, the global suggestion text will be used.


Parameters
txt <String> A string to get suggestions for.
Returns
returns this so that calls can be chained.

 toJSON

String toJSON ( )

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


Returns
returns this object's internal suggest property.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo