- Elasticsearch Guide: other versions:
- Getting Started
- Setup
- Breaking changes in 1.0
- API Conventions
- Document APIs
- Search APIs
- Search
- URI Search
- Request Body Search
- Search Template
- Search Shards API
- Aggregations
- Min Aggregation
- Max Aggregation
- Sum Aggregation
- Avg Aggregation
- Stats Aggregation
- Extended Stats Aggregation
- Value Count Aggregation
- Percentiles Aggregation
- Percentile Ranks Aggregation
- Cardinality Aggregation
- Geo Bounds Aggregation
- Top hits Aggregation
- Global Aggregation
- Filter Aggregation
- Missing Aggregation
- Nested Aggregation
- Reverse nested Aggregation
- Terms Aggregation
- Significant Terms Aggregation
- Range Aggregation
- Date Range Aggregation
- IPv4 Range Aggregation
- Histogram Aggregation
- Date Histogram Aggregation
- Geo Distance Aggregation
- GeoHash grid Aggregation
- Facets
- Suggesters
- Multi Search API
- Count API
- Validate API
- Explain API
- Percolator
- More Like This API
- Indices APIs
- Create Index
- Delete Index
- Indices Exists
- Open / Close Index API
- Put Mapping
- Get Mapping
- Get Field Mapping
- Types Exists
- Delete Mapping
- Index Aliases
- Update Indices Settings
- Get Settings
- Analyze
- Index Templates
- Warmers
- Status
- Indices Stats
- Indices Segments
- Indices Recovery
- Clear Cache
- Flush
- Refresh
- Optimize
- cat APIs
- Cluster APIs
- Query DSL
- Queries
- Match Query
- Multi Match Query
- Bool Query
- Boosting Query
- Common Terms Query
- Constant Score Query
- Dis Max Query
- Filtered Query
- Fuzzy Like This Query
- Fuzzy Like This Field Query
- Function Score Query
- Fuzzy Query
- GeoShape Query
- Has Child Query
- Has Parent Query
- Ids Query
- Indices Query
- Match All Query
- More Like This Query
- More Like This Field Query
- Nested Query
- Prefix Query
- Query String Query
- Simple Query String Query
- Range Query
- Regexp Query
- Span First Query
- Span Multi Term Query
- Span Near Query
- Span Not Query
- Span Or Query
- Span Term Query
- Term Query
- Terms Query
- Top Children Query
- Wildcard Query
- Minimum Should Match
- Multi Term Query Rewrite
- Template Query
- Filters
- And Filter
- Bool Filter
- Exists Filter
- Geo Bounding Box Filter
- Geo Distance Filter
- Geo Distance Range Filter
- Geo Polygon Filter
- GeoShape Filter
- Geohash Cell Filter
- Has Child Filter
- Has Parent Filter
- Ids Filter
- Indices Filter
- Limit Filter
- Match All Filter
- Missing Filter
- Nested Filter
- Not Filter
- Or Filter
- Prefix Filter
- Query Filter
- Range Filter
- Regexp Filter
- Script Filter
- Term Filter
- Terms Filter
- Type Filter
- Queries
- Mapping
- Analysis
- Analyzers
- Tokenizers
- Token Filters
- Standard Token Filter
- ASCII Folding Token Filter
- Length Token Filter
- Lowercase Token Filter
- Uppercase Token Filter
- NGram Token Filter
- Edge NGram Token Filter
- Porter Stem Token Filter
- Shingle Token Filter
- Stop Token Filter
- Word Delimiter Token Filter
- Stemmer Token Filter
- Stemmer Override Token Filter
- Keyword Marker Token Filter
- Keyword Repeat Token Filter
- KStem Token Filter
- Snowball Token Filter
- Phonetic Token Filter
- Synonym Token Filter
- Compound Word Token Filter
- Reverse Token Filter
- Elision Token Filter
- Truncate Token Filter
- Unique Token Filter
- Pattern Capture Token Filter
- Pattern Replace Token Filter
- Trim Token Filter
- Limit Token Count Token Filter
- Hunspell Token Filter
- Common Grams Token Filter
- Normalization Token Filter
- CJK Width Token Filter
- CJK Bigram Token Filter
- Delimited Payload Token Filter
- Keep Words Token Filter
- Classic Token Filter
- Apostrophe Token Filter
- Character Filters
- ICU Analysis Plugin
- Modules
- Index Modules
- Testing
- Glossary of terms
WARNING: Version 1.3 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Hunspell Token Filter
editHunspell Token Filter
editBasic support for hunspell stemming. Hunspell dictionaries will be
picked up from a dedicated hunspell directory on the filesystem
(defaults to <path.conf>/hunspell
). Each dictionary is expected to
have its own directory named after its associated locale (language).
This dictionary directory is expected to hold a single *.aff
and
one or more *.dic
files (all of which will automatically be picked up).
For example, assuming the default hunspell location is used, the
following directory layout will define the en_US
dictionary:
- conf |-- hunspell | |-- en_US | | |-- en_US.dic | | |-- en_US.aff
The location of the hunspell directory can be configured using the
indices.analysis.hunspell.dictionary.location
settings in
elasticsearch.yml.
Each dictionary can be configured with one setting:
-
ignore_case
-
If true, dictionary matching will be case insensitive
(defaults to
false
)
This setting can be configured globally in elasticsearch.yml
using
-
indices.analysis.hunspell.dictionary.ignore_case
or for specific dictionaries:
-
indices.analysis.hunspell.dictionary.en_US.ignore_case
.
It is also possible to add settings.yml
file under the dictionary
directory which holds these settings (this will override any other
settings defined in the elasticsearch.yml
).
One can use the hunspell stem filter by configuring it the analysis settings:
{ "analysis" : { "analyzer" : { "en" : { "tokenizer" : "standard", "filter" : [ "lowercase", "en_US" ] } }, "filter" : { "en_US" : { "type" : "hunspell", "locale" : "en_US", "dedup" : true } } } }
The hunspell token filter accepts four options:
-
locale
-
A locale for this filter. If this is unset, the
lang
orlanguage
are used instead - so one of these has to be set. -
dictionary
-
The name of a dictionary. The path to your hunspell
dictionaries should be configured via
indices.analysis.hunspell.dictionary.location
before. -
dedup
-
If only unique terms should be returned, this needs to be
set to
true
. Defaults totrue
. -
longest_only
-
If only the longest term should be returned, set this to
true
. Defaults tofalse
: all possible stems are returned.
As opposed to the snowball stemmers (which are algorithm based) this is a dictionary lookup based stemmer and therefore the quality of the stemming is determined by the quality of the dictionary.
Dictionary loading
editBy default, the configured (indices.analysis.hunspell.dictionary.location
)
or default Hunspell directory (config/hunspell/
) is checked for dictionaries
when the node starts up, and any dictionaries are automatically loaded.
Dictionary loading can be deferred until they are actually used by setting
indices.analysis.hunspell.dictionary.lazy
to `true`in the config file.
References
editHunspell is a spell checker and morphological analyzer designed for languages with rich morphology and complex word compounding and character encoding.
- Wikipedia, http://en.wikipedia.org/wiki/Hunspell
- Source code, http://hunspell.sourceforge.net/
- Open Office Hunspell dictionaries, http://wiki.openoffice.org/wiki/Dictionaries
- Mozilla Hunspell dictionaries, https://addons.mozilla.org/en-US/firefox/language-tools/
- Chromium Hunspell dictionaries, http://src.chromium.org/viewvc/chrome/trunk/deps/third_party/hunspell_dictionaries/
On this page