# AutoCompletion for Hindi (Indian Language)

**URL:** https://discuss.elastic.co/t/autocompletion-for-hindi-indian-language/224247
**Category:** Elasticsearch
**Created:** [March 19, 2020, 10:12am UTC](https://discuss.elastic.co/t/autocompletion-for-hindi-indian-language/224247 "2020-03-19T10:12:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![chivas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chivas/32/58800_2.png) [@chivas](https://discuss.elastic.co/u/chivas)
#### Post date: [March 19, 2020, 10:12am UTC](https://discuss.elastic.co/t/autocompletion-for-hindi-indian-language/224247/1 "2020-03-19T10:12:23Z")

</div>

Hello,  
I am trying to use the Edge Ngram Tokeniser for auto complete search. Below is my index definition:

```
PUT hindi_test
{
  "settings": {
    "analysis": {
            "filter": {
        "hindi_stop": {
          "type": "stop",
          "stopwords": "_hindi_" 
        },
        "hindi_keywords": {
          "type": "keyword_marker",
          "keywords": ["उदाहरण"] 
        },
        "hindi_stemmer": {
          "type": "stemmer",
          "language": "hindi"
        }
      },
      "analyzer": {
        "hindi": {
          "tokenizer": "autocomplete",
          "filter": [
            "lowercase"
          ]
        },
        "autocomplete_search": {
          "tokenizer": "lowercase"
        }
      },
      "tokenizer": {
        "autocomplete": {
          "type": "edge_ngram",
          "min_gram": 1,
          "max_gram": 10,
          "token_chars": [
            "letter","digit"
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "name": {
        "type": "text",
        "analyzer": "hindi",
        "search_analyzer": "autocomplete_search"
      }
    }
  }
}

```

However, when I analyse using below:

POST hindi\_test/\_analyze  
{  
"analyzer": "hindi",  
"text": "डीसील्वा"  
}

My output is -

> ```
> {
> "tokens" : [
> {
> "token" : "ड",
> "start_offset" : 0,
> "end_offset" : 1,
> "type" : "word",
> "position" : 0
> },
> {
> "token" : "स",
> "start_offset" : 2,
> "end_offset" : 3,
> "type" : "word",
> "position" : 1
> },
> {
> "token" : "ल",
> "start_offset" : 4,
> "end_offset" : 5,
> "type" : "word",
> "position" : 2
> },
> {
> "token" : "व",
> "start_offset" : 6,
> "end_offset" : 7,
> "type" : "word",
> "position" : 3
> }
> ]
> }
> 
> ```

What I am assuming is diacritics and conjuncts are being lost during tokenisation. Any pointers if I am missing something in my index definition?  
Any help appreciated.  
Thanks in advance!

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [March 19, 2020, 2:45pm UTC](https://discuss.elastic.co/t/autocompletion-for-hindi-indian-language/224247/2 "2020-03-19T14:45:38Z")

</div>

Just a wild guess over here due to not having experience with hindi. Try removing parts of your mapping like stemming/stopwords and see if the problem persists.

Also, if you are using Elasticsearch 7.2 and above, you may want to take a look at the [search-as-you-type datatype](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/search-as-you-type.html).

--Alex

---

<div class="post-metadata">

### Author: ![chivas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chivas/32/58800_2.png) [@chivas](https://discuss.elastic.co/u/chivas)
#### Post date: [March 20, 2020, 9:54am UTC](https://discuss.elastic.co/t/autocompletion-for-hindi-indian-language/224247/3 "2020-03-20T09:54:04Z")

</div>

Thanks @spinscale, the search-as-you-type datatype works fine.  
Thanks for your help!

---

<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: [April 17, 2020, 9:55am UTC](https://discuss.elastic.co/t/autocompletion-for-hindi-indian-language/224247/4 "2020-04-17T09:55:18Z")

</div>

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