2013-08-28 19:24:34 -04:00
|
|
|
[[search-suggesters-term]]
|
|
|
|
=== Term suggester
|
|
|
|
|
|
|
|
NOTE: In order to understand the format of suggestions, please
|
|
|
|
read the <<search-suggesters>> page first.
|
|
|
|
|
|
|
|
The `term` suggester 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. The `term` suggester
|
|
|
|
doesn't take the query into account that is part of request.
|
|
|
|
|
2016-01-21 12:00:46 -05:00
|
|
|
==== Common suggest options:
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
[horizontal]
|
2016-01-21 12:00:46 -05:00
|
|
|
`text`::
|
2013-08-28 19:24:34 -04:00
|
|
|
The suggest text. The suggest text is a required option that
|
|
|
|
needs to be set globally or per suggestion.
|
|
|
|
|
2016-01-21 12:00:46 -05:00
|
|
|
`field`::
|
2013-08-28 19:24:34 -04:00
|
|
|
The field to fetch the candidate suggestions from. This is
|
|
|
|
an required option that either needs to be set globally or per
|
2016-01-21 12:00:46 -05:00
|
|
|
suggestion.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2016-01-21 12:00:46 -05:00
|
|
|
`analyzer`::
|
2013-08-28 19:24:34 -04:00
|
|
|
The analyzer to analyse the suggest text with. Defaults
|
2016-01-21 12:00:46 -05:00
|
|
|
to the search analyzer of the suggest field.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2016-01-21 12:00:46 -05:00
|
|
|
`size`::
|
2013-08-28 19:24:34 -04:00
|
|
|
The maximum corrections to be returned per suggest text
|
2016-01-21 12:00:46 -05:00
|
|
|
token.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2016-01-21 12:00:46 -05:00
|
|
|
`sort`::
|
2013-08-28 19:24:34 -04:00
|
|
|
Defines how suggestions should be sorted per suggest text
|
|
|
|
term. Two possible values:
|
|
|
|
+
|
2016-01-21 12:00:46 -05:00
|
|
|
** `score`: Sort by score first, then document frequency and
|
|
|
|
then the term itself.
|
2013-08-28 19:24:34 -04:00
|
|
|
** `frequency`: Sort by document frequency first, then similarity
|
2016-01-21 12:00:46 -05:00
|
|
|
score and then the term itself.
|
2013-08-28 19:24:34 -04:00
|
|
|
+
|
2016-01-21 12:00:46 -05:00
|
|
|
`suggest_mode`::
|
2013-08-28 19:24:34 -04:00
|
|
|
The suggest mode controls what suggestions are
|
|
|
|
included or controls for what suggest text terms, suggestions should be
|
2016-01-21 12:00:46 -05:00
|
|
|
suggested. Three possible values can be specified:
|
|
|
|
+
|
2014-05-05 09:53:37 -04:00
|
|
|
** `missing`: Only provide suggestions for suggest text terms that are
|
2016-01-21 12:00:46 -05:00
|
|
|
not in the index. This is the default.
|
2013-08-28 19:24:34 -04:00
|
|
|
** `popular`: Only suggest suggestions that occur in more docs then
|
2016-01-21 12:00:46 -05:00
|
|
|
the original suggest text term.
|
2013-08-28 19:24:34 -04:00
|
|
|
** `always`: Suggest any matching suggestions based on terms in the
|
|
|
|
suggest text.
|
|
|
|
|
2016-01-21 12:00:46 -05:00
|
|
|
==== Other term suggest options:
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
[horizontal]
|
2016-01-21 12:00:46 -05:00
|
|
|
`lowercase_terms`::
|
|
|
|
Lower cases the suggest text terms after text analysis.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2016-01-21 12:00:46 -05:00
|
|
|
`max_edits`::
|
2013-08-28 19:24:34 -04:00
|
|
|
The maximum edit distance candidate suggestions can
|
|
|
|
have in order to be considered as a suggestion. Can only be a value
|
|
|
|
between 1 and 2. Any other value result in an bad request error being
|
2016-01-21 12:00:46 -05:00
|
|
|
thrown. Defaults to 2.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2016-01-21 12:00:46 -05:00
|
|
|
`prefix_length`::
|
2013-08-28 19:24:34 -04:00
|
|
|
The number of minimal prefix characters that must
|
|
|
|
match in order be a candidate suggestions. Defaults to 1. Increasing
|
|
|
|
this number improves spellcheck performance. Usually misspellings don't
|
2016-01-21 12:00:46 -05:00
|
|
|
occur in the beginning of terms. (Old name "prefix_len" is deprecated)
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2016-01-21 12:00:46 -05:00
|
|
|
`min_word_length`::
|
2013-08-28 19:24:34 -04:00
|
|
|
The minimum length a suggest text term must have in
|
2014-01-02 11:11:20 -05:00
|
|
|
order to be included. Defaults to 4. (Old name "min_word_len" is deprecated)
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2016-01-21 12:00:46 -05:00
|
|
|
`shard_size`::
|
2013-08-28 19:24:34 -04:00
|
|
|
Sets the maximum number of suggestions to be retrieved
|
|
|
|
from each individual shard. During the reduce phase only the top N
|
|
|
|
suggestions are returned based on the `size` option. Defaults to the
|
|
|
|
`size` option. Setting this to a value higher than the `size` can be
|
|
|
|
useful in order to get a more accurate document frequency for spelling
|
|
|
|
corrections at the cost of performance. Due to the fact that terms are
|
|
|
|
partitioned amongst shards, the shard level document frequencies of
|
|
|
|
spelling corrections may not be precise. Increasing this will make these
|
2016-01-21 12:00:46 -05:00
|
|
|
document frequencies more precise.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2016-01-21 12:00:46 -05:00
|
|
|
`max_inspections`::
|
2013-08-28 19:24:34 -04:00
|
|
|
A factor that is used to multiply with the
|
|
|
|
`shards_size` in order to inspect more candidate spell corrections on
|
|
|
|
the shard level. Can improve accuracy at the cost of performance.
|
2016-01-21 12:00:46 -05:00
|
|
|
Defaults to 5.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2016-01-21 12:00:46 -05:00
|
|
|
`min_doc_freq`::
|
2013-08-28 19:24:34 -04:00
|
|
|
The minimal threshold in number of documents a
|
|
|
|
suggestion should appear in. This can be specified as an absolute number
|
|
|
|
or as a relative percentage of number of documents. This can improve
|
|
|
|
quality by only suggesting high frequency terms. Defaults to 0f and is
|
|
|
|
not enabled. If a value higher than 1 is specified then the number
|
|
|
|
cannot be fractional. The shard level document frequencies are used for
|
2016-01-21 12:00:46 -05:00
|
|
|
this option.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2016-01-21 12:00:46 -05:00
|
|
|
`max_term_freq`::
|
2013-08-28 19:24:34 -04:00
|
|
|
The maximum threshold in number of documents a
|
|
|
|
suggest text token can exist in order to be included. Can be a relative
|
|
|
|
percentage number (e.g 0.4) or an absolute number to represent document
|
|
|
|
frequencies. If an value higher than 1 is specified then fractional can
|
|
|
|
not be specified. Defaults to 0.01f. This can be used to exclude high
|
|
|
|
frequency terms from being spellchecked. High frequency terms are
|
|
|
|
usually spelled correctly on top of this also improves the spellcheck
|
|
|
|
performance. The shard level document frequencies are used for this
|
|
|
|
option.
|
2016-01-21 12:00:46 -05:00
|
|
|
|
|
|
|
`string_distance`::
|
|
|
|
Which string distance implementation to use for comparing how similar
|
2016-02-09 05:07:32 -05:00
|
|
|
suggested terms are. Five possible values can be specified:
|
2016-01-21 12:00:46 -05:00
|
|
|
`internal` - The default based on damerau_levenshtein but highly optimized
|
2016-02-09 05:07:32 -05:00
|
|
|
for comparing string distance for terms inside the index.
|
2016-01-21 12:00:46 -05:00
|
|
|
`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.
|