# Hunspell

**URL:** <https://discuss.elastic.co/t/hunspell/106807>\
**Category:** Elasticsearch\
**Created:** [November 8, 2017, 6:34am UTC](https://discuss.elastic.co/t/hunspell/106807 "2017-11-08T06:34:26Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Atul\_Harsha](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@Atul\_Harsha](https://discuss.elastic.co/u/Atul_Harsha)\
**Post date:** [November 8, 2017, 6:34am UTC](https://discuss.elastic.co/t/hunspell/106807/1 "2017-11-08T06:34:26Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [November 8, 2017, 8:11am UTC](https://discuss.elastic.co/t/hunspell/106807/2 "2017-11-08T08:11:46Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![Atul\_Harsha](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@Atul\_Harsha](https://discuss.elastic.co/u/Atul_Harsha)\
**Post date:** [November 8, 2017, 9:08am UTC](https://discuss.elastic.co/t/hunspell/106807/3 "2017-11-08T09:08:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [November 8, 2017, 9:28am UTC](https://discuss.elastic.co/t/hunspell/106807/4 "2017-11-08T09:28:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Atul\_Harsha](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@Atul\_Harsha](https://discuss.elastic.co/u/Atul_Harsha)\
**Post date:** [November 8, 2017, 9:30am UTC](https://discuss.elastic.co/t/hunspell/106807/5 "2017-11-08T09:30:48Z")

</div>

> [@abdon](#):
>
> o, 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 n

Yes I did the same

---

<div class="post-metadata">

**Author:** ![Atul\_Harsha](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@Atul\_Harsha](https://discuss.elastic.co/u/Atul_Harsha)\
**Post date:** [November 8, 2017, 9:36am UTC](https://discuss.elastic.co/t/hunspell/106807/6 "2017-11-08T09:36:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [November 8, 2017, 11:41am UTC](https://discuss.elastic.co/t/hunspell/106807/7 "2017-11-08T11:41:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Atul\_Harsha](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@Atul\_Harsha](https://discuss.elastic.co/u/Atul_Harsha)\
**Post date:** [November 8, 2017, 12:17pm UTC](https://discuss.elastic.co/t/hunspell/106807/8 "2017-11-08T12:17:22Z")

</div>

> 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/](http://download.services.openoffice.org/contrib/dictionaries/)

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [November 8, 2017, 1:47pm UTC](https://discuss.elastic.co/t/hunspell/106807/9 "2017-11-08T13:47:14Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![Atul\_Harsha](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@Atul\_Harsha](https://discuss.elastic.co/u/Atul_Harsha)\
**Post date:** [November 9, 2017, 8:20pm UTC](https://discuss.elastic.co/t/hunspell/106807/10 "2017-11-09T20:20:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [November 10, 2017, 5:26am UTC](https://discuss.elastic.co/t/hunspell/106807/11 "2017-11-10T05:26:36Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 8, 2017, 5:26am UTC](https://discuss.elastic.co/t/hunspell/106807/12 "2017-12-08T05:26:40Z")

</div>

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