Phil B
Phil B

Reputation: 6037

Where to put Hunspell dictionary for Elasticsearch

The Elasticsearch Hunspell docs say to put the dictionaries in config/hunspell

Is it

/usr/share/elasticsearch/config/hunspell/

or

/etc/elasticsearch/config/hunspell/

or

/etc/elasticsearch/hunspell/

or something else?

So far, I've tried all of those with no success.

There is some talk about a similar issue in this bug report, but I don't see an answer.

Upvotes: 2

Views: 5397

Answers (5)

Artem Shevtsov
Artem Shevtsov

Reputation: 516

The location of the Hunspell directory can be changed by setting indices.analysis.hunspell.dictionary.location in the config/elasticsearch.yml file.

https://www.elastic.co/guide/en/elasticsearch/guide/current/hunspell.html

Upvotes: 1

Bira
Bira

Reputation: 5506

For the version 6.5.1, no need to create config directory

/usr/local/etc/elasticsearch/hunspell place all language folders here.

-- hunspell
     |    |-- en_US
     |    |    |-- en_US.dic
     |    |    |-- en_US.aff
     |    |-- ru_RU
     |    |    |-- ru_RU.dic
     |    |    |-- ru_RU.aff

After that just restart the elasticsearch service.

After the installation you will see this.

\Data:    /usr/local/var/lib/elasticsearch/elasticsearch_bira/
Logs:    /usr/local/var/log/elasticsearch/elasticsearch_bira.log
Plugins: /usr/local/var/elasticsearch/plugins/
Config:  /usr/local/etc/elasticsearch/

Upvotes: 3

Structure of elasticsearch/config must be

- conf
     |-- hunspell
     |    |-- en_US
     |    |    |-- en_US.dic
     |    |    |-- en_US.aff
     |    |-- ru_RU
     |    |    |-- ru_RU.dic
     |    |    |-- ru_RU.aff

Upvotes: 0

Phil B
Phil B

Reputation: 6037

Here is an example of the directory structure for Elasticsearch 5 installed using the .deb installer:

# Elasticsearch home directory
#ES_HOME=/usr/share/elasticsearch

# Elasticsearch configuration directory
#CONF_DIR=/etc/elasticsearch

# Elasticsearch data directory
#DATA_DIR=/var/lib/elasticsearch

# Elasticsearch logs directory
#LOG_DIR=/var/log/elasticsearch

# Elasticsearch PID directory
#PID_DIR=/var/run/elasticsearch

In this case, the Hunspell dictionaries should be in a folder called /hunspell in the config directory, which in this particular case would be: /etc/elasticsearch/hunspell

Upvotes: 4

Phil B
Phil B

Reputation: 6037

Turns out that the symbolic links are not followed by elasticsearch (see here), so the ACTUAL files need to be at the location specified.

Also, the file permissions for the hunspell files need to allow the elasticsearch user to access them. Ex (in /etc/elasticsearch/hunspell/):

drwxr-xr-x 2 root elasticsearch 4.0K Sep 9 09:24 nl_NL

Upvotes: -1

Related Questions