elastic / elasticsearch-definitive-guide

The Definitive Guide to Elasticsearch
https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html
Other
3.55k stars 2.83k forks source link

Hunspell Location setting broken #495

Open clintongormley opened 8 years ago

clintongormley commented 8 years ago

From @ntent-ashton on March 31, 2016 22:52

Elasticsearch version: elasticsearch-2.2.0-1.noarch

JVM version: java version "1.8.0_66" Java(TM) SE Runtime Environment (build 1.8.0_66-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

OS version: CentOS 6.7

Description of the problem including expected versus actual behavior: According to https://www.elastic.co/guide/en/elasticsearch/guide/current/hunspell.html#_installing_a_dictionary I should be able to set indices.analysis.hunspell.dictionary.location to wherever I want. Unfortunately, the code says no: https://github.com/elastic/elasticsearch/blob/v2.2.2/core/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java#L115-L121

The logic there is if OLD_HUNSPELL_LOCATION is set, cause an error - and OLD_HUNSPELL_LOCATION is set by the value of indices.analysis.hunspell.dictionary.location.

The result of this is that if you use the setting in the docs, the service refuses to start.

Steps to reproduce:

  1. Add hunspell directories to a directory outside of "config/" (in my case, /etc/elasticsearch/hunspell instead of /etc/elasticsearch/01/hunspell)
  2. Set indices.analysis.hunspell.dictionary.location to /etc/elasticsearch/hunspell
  3. Attempt to restart the process

Provide logs (if relevant):

[2016-03-31 15:10:43,540][ERROR][bootstrap                ] Guice Exception: java.lang.IllegalArgumentException: please, put your hunspell dictionaries under config/hunspell !
    at org.elasticsearch.indices.analysis.HunspellService.resolveHunspellDirectory(HunspellService.java:118)
    at org.elasticsearch.indices.analysis.HunspellService.<init>(HunspellService.java:89)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at <<<guice>>>
    at org.elasticsearch.node.Node.<init>(Node.java:200)
    at org.elasticsearch.node.Node.<init>(Node.java:128)
    at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178)
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

Copied from original issue: elastic/elasticsearch#17465

clintongormley commented 8 years ago

Hi @ntent-ashton

I'll move this issue to the def-guide repo.

podolinek commented 8 years ago

Same issue in mac os x installed via homebrew (2.2.1)