# Hunspell dictionaries

**URL:** <https://discuss.elastic.co/t/hunspell-dictionaries/186055>\
**Category:** Elasticsearch\
**Created:** [June 17, 2019, 11:54am UTC](https://discuss.elastic.co/t/hunspell-dictionaries/186055 "2019-06-17T11:54:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aiswarya](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@aiswarya](https://discuss.elastic.co/u/aiswarya)\
**Post date:** [June 17, 2019, 11:54am UTC](https://discuss.elastic.co/t/hunspell-dictionaries/186055/1 "2019-06-17T11:54:52Z")

</div>

i'm having an index 'main' where i'm having headings of a site.

my requirement is to search this index with some keywords/phrases .

Then to create a new index 'result' with the matches.

i'm using 'Hunspell'

i need

computer =\> computers  
computers =\>computer  
drink=\>drank/drunk  
drunk=\>drank/drink  
drank=\> drink/drunk  
jump=\>jumping  
jumping=\>jump

so,after the configuration of Hunspell i gave a word "print" to be searched inside main index which have "printed" in heading ,but it didn't produce any hits .

Hunspell setting ..

> client.indices.putSettings({  
> index: 'result',  
> body: { "analysis" : {  
> "analyzer" : {  
> "en" : {  
> "tokenizer" :"lowercase",  
> "filter" : ["lowercase", "en\_US"]  
> }  
> },  
> "filter" : {  
> "en\_US" : {  
> "type" : "hunspell",  
> "locale" : "en\_US",  
> "dedup" : true  
> }  
> }  
> }}  
> });

the same setting is given for the main index creation as well

> client.search({  
> "index": 'main',  
> "type": 'index',  
> "body": {  
> "query": {  
> "bool": {  
> "should": [  
> {"match": {"heading": "print"}}  
> ]  
> }  
> }},  
> },function (error, response,status) {  
> if (error){  
> console.log(error);  
> }  
> else {  
> response.hits.hits.forEach(function(hit){  
> // console.log();  
> client.bulk({  
> "body": [  
> {"index":{  
> "\_index":"result",  
> "\_type":"index",  
> "\_id":" "}},  
> {"body": hit.\_source }]}) })  
> } });

I will be grateful if you can provide some help..

---

<div class="post-metadata">

**Author:** ![aiswarya](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@aiswarya](https://discuss.elastic.co/u/aiswarya)\
**Post date:** [June 18, 2019, 10:26am UTC](https://discuss.elastic.co/t/hunspell-dictionaries/186055/2 "2019-06-18T10:26:22Z")

</div>

is there any way to do this ???

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [June 20, 2019, 8:30pm UTC](https://discuss.elastic.co/t/hunspell-dictionaries/186055/3 "2019-06-20T20:30:22Z")

</div>

Based on your description, it sounds like you are having trouble matching documents in your "main" index, which is unrelated to hunspell. You should first ensure your documents are structured as you expect. Try adding a single document, then doing your search on the `heading` field and making sure you find the doc.

Once you get that working, you should consider using the [reindex api](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html), which is specifically designed to allow searching on one index and indexing the results into another index.

---

<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:** [July 18, 2019, 8:30pm UTC](https://discuss.elastic.co/t/hunspell-dictionaries/186055/4 "2019-07-18T20:30:29Z")

</div>

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