Hunspell dictionary issue installation

Hi,

I'm trying to install hunspell dictionary for italian language but I don't know where set the dictionary path.

Configuration:
Os: CentOS 6.5
Elasticsearch: 2.1.0 - path: /etc/elasticsearch

I put all the dictionaries into /etc/elasticsearch/config/hunspell/it_IT

  • it_IT.aff
  • it_IT.dic

I don't know how to add the dictionary into configuration elasticsearch.yml
I've tried with this config into elasticsearch.yml:
path.conf: /etc/elasticsearch/config/hunspell/it_IT/it_IT.dic

but when I restart the service I've got error.

Please help me!!

What kind of error do you get?

I suppose you already found: Hunspell Stemmer | Elasticsearch: The Definitive Guide [2.x] | Elastic

This is the error i get

Avvio di elasticsearch: log4j:WARN No appenders could be found for logger (bootstrap).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" java.lang.IllegalStateException: Unable to access 'path.conf' (/etc/elasticsearch/config/hunspell/it_IT/it_IT.dic)
Likely root cause: java.nio.file.NotDirectoryException: /etc/elasticsearch/config/hunspell/it_IT/it_IT.dic
	at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:253)
	at org.elasticsearch.bootstrap.Security.addPath(Security.java:227)
	at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:194)
	at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:184)
	at org.elasticsearch.bootstrap.Security.configure(Security.java:105)
	at org.elasticsearch.bootstrap.Bootstrap.setupSecurity(Bootstrap.java:196)
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:167)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
                                                           [FALLITO]

this is the config I've added into elasticsearch.yml
path.conf: /etc/elasticsearch/config/hunspell/it_IT/it_IT.dic

this is my elastisearch.yml

# Use a descriptive name for the node:
node.name: "Elastic Netweek Local"

# Path to directory where to store the data (separate multiple locations by comma):
path.data: /var/elasticsearch/data

# Path to log files:
path.logs: /var/elasticsearch/logs

# TESTING PARAMS
index.number_of_shards: 1
index.number_of_replicas: 0

# ENABLE DYNAMIC SCRIPTS
script.inline: on
script.indexed: on

path.conf: /etc/elasticsearch/config/hunspell/it_IT/it_IT.dic

Did you check that the directory listed in the error message exists and is readable by whatever user your elasticsearch instance runs as?

Isabel

I had the same idea, so I've set the path /etc/elasticsearch/config to 777 permissions but nothing changes.
I start the service as root, so I should not have problems of permissions, but the error is the same....

I don't know what error I'm committing.

I'm using Elasticsearch 2.1 reading the setting changest from 1.x to 2.x I sow that:

Hunspell dictionary configuration
The parameter indices.analysis.hunspell.dictionary.location has been removed, and <path.conf>/hunspell is always used.

So it seems that if I put the dictionary into /etc/elasticsearch/config/hunspell/it_IT/it_IT.dic|it_IT.aff
Elastic load directly......

But if I make the post request for creating the index

{
    "analysis" : {
        "analyzer" : {
            "en" : {
                "tokenizer" : "standard",
                "filter" : [ "lowercase", "it_IT" ]
            }
        },
        "filter" : {
            "en_US" : {
                "type" : "hunspell",
                "locale" : "it_IT",
                "dedup" : true
            }
        }
    }
}

the response is :

{
  "error": {
    "root_cause": [
      {
        "type": "index_creation_exception",
        "reason": "failed to create index"
      }
    ],
    "type": "unchecked_execution_exception",
    "reason": "ElasticsearchException[Could not find hunspell dictionary [en_US]]",
    "caused_by": {
      "type": "exception",
      "reason": "Could not find hunspell dictionary [en_US]"
    }
  },
  "status": 500
}

did you ever solve this issue?

No, not solved do u have some suggest?

Yes, I just solved this last Friday.

Copy the Hunspell folder under /etc/elasticsearch and not under /etc/elasticsearch/config. Make sure it has right permissions (chown if required). I am assuming that you didn't override the default config directory which is /etc/elasticsearch.

See my reply here: http://stackoverflow.com/questions/37168208/hunspell-for-elasticsearch/41517146#41517146

1 Like