Hunspell

INPUT:

PUT /my_index
{
  "settings": {
    "analysis": {
      "filter": {
        "en_US": {
          "type":     "hunspell",
          "language": "en_US" 
        }
      },
      "analyzer": {
        "en_US": {
          "tokenizer":  "standard",
          "filter":   [ "lowercase", "en_US" ]
        }
      }
    }
  }
}

OUTPUT:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_state_exception",
        "reason": "failed to load hunspell dictionary for locale: en_US"
      }
    ],
    "type": "illegal_state_exception",
    "reason": "failed to load hunspell dictionary for locale: en_US",
    "caused_by": {
      "type": "exception",
      "reason": "Could not find hunspell dictionary [en_US]"
    }
  },
  "status": 500
}

How should I resolve this error to work with hunspell dictionary?

You will need to deploy the dictionary you want to use on the filesystem on all of your nodes. Our documentation explains how to do this: https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-hunspell-tokenfilter.html

Elasticsearch does not ship with dictionaries, but the documentation mentioned above has some links to dictionaries available on the internet.

Thanks for the reply @abdon
I had already referred the doc and installed the dictionary, but still I m unable to resolve the query. Can you please help me with it?

So, to confirm: you have created a directory hunspell inside the Elasticsearch configuration directory (the directory that's configured through the path.conf setting). Inside the hunspell directory you have created a directory en_US. And inside that directory you have placed the .aff file and the .dic files that you downloaded?

You need to do this on all of your nodes, and you need to restart the nodes after deploying the files.

Yes I did the same

I guess there is some configuration issue in the .yml file of the elasticsearch. Can help me with the configuration file?

There is nothing you need to do in the elasticsearch.yml file.

The error message really suggests that Elasticsearch cannot find those .aff and .dic files.

Does the Elasticsearch process have read rights on those files? Are you sure there is no hidden extension (when downloading the files, I noticed my browser appended a .txt extension to the file names).

What version of Elasticsearch are you using? Which .aff and .dic files are you using?

What version of Elasticsearch are you using?

Elasticsearch Version: 5.2.2

Which .aff and .dic files are you using?

en_US
http://download.services.openoffice.org/contrib/dictionaries/

Not sure what the problem here is. I have just tried these dictionary files, and they work fine for me. I would double check that:

  • you have actually placed the files in the correct path.conf configuration directory (the same directory containing your elasticsearch.yml file)

  • there is no typo in the directory and file names.

  • your file structure looks exactly like this, and you have named the files and directories the same:

      conf
      	elasticsearch.yml
      	hunspell
      		en_US
      			en_US.dic
      			en_US.aff

Yes File are placed in the same way. Can you attach the zip file which you are using

I downloaded the ZIP file you linked in your previous message.

I have no idea why it doesn't work for you...

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.