# Autosuggestion for integer not working in elastic search

**URL:** <https://discuss.elastic.co/t/autosuggestion-for-integer-not-working-in-elastic-search/73329>\
**Category:** Elasticsearch\
**Created:** [January 31, 2017, 9:20am UTC](https://discuss.elastic.co/t/autosuggestion-for-integer-not-working-in-elastic-search/73329 "2017-01-31T09:20:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Ranjan](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@Rahul\_Ranjan](https://discuss.elastic.co/u/Rahul_Ranjan)\
**Post date:** [January 31, 2017, 9:20am UTC](https://discuss.elastic.co/t/autosuggestion-for-integer-not-working-in-elastic-search/73329/1 "2017-01-31T09:20:38Z")

</div>

I am using the Completion Suggesters as following. There is an issue for numeric autosuggest

index : { "\_index": "mysuggestors", "\_type": "suggest", "\_id": "584a4455", "\_score": 1, "\_source": { "name": "Test 100AH 200 Title", "suggest": { "input": ["Test", "100AH", "200", "100", "200 Title", "Titl",], "output": "Test 100AH 200 Title", "payload": { "id": "584a4455" }, "weight": 10 } } }

case 1. autosuggest query :

{"suggestions": { "text": "100", "completion": {"field": "suggest"} }}

response : empty response

case 2. autosuggest query :

{"suggestions": { "text": "100A", "completion": {"field": "suggest"} }}

response : valid response

case 3. autosuggest query :

{"suggestions": { "text": "Tes", "completion": {"field": "suggest"} }}

response : valid response

---

<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:** [January 31, 2017, 10:22am UTC](https://discuss.elastic.co/t/autosuggestion-for-integer-not-working-in-elastic-search/73329/2 "2017-01-31T10:22:43Z")

</div>

Hey,

this might stem from using the `simple` analyzer in the completion suggester. You can change the configuration in the mapping if you need to.

--Alex

---

<div class="post-metadata">

**Author:** ![Rahul\_Ranjan](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@Rahul\_Ranjan](https://discuss.elastic.co/u/Rahul_Ranjan)\
**Post date:** [January 31, 2017, 10:46am UTC](https://discuss.elastic.co/t/autosuggestion-for-integer-not-working-in-elastic-search/73329/3 "2017-01-31T10:46:12Z")

</div>

Hi ,  
I am newbie to elastic search.. what i need to use instead of simple analyzer?

currently my analyzer is  
index\_analyzer simple  
search\_analyzer simple

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [January 31, 2017, 10:55am UTC](https://discuss.elastic.co/t/autosuggestion-for-integer-not-working-in-elastic-search/73329/4 "2017-01-31T10:55:59Z")

</div>

Hi,

the "[standard](https://www.elastic.co/guide/en/elasticsearch/reference/5.1/analysis-standard-analyzer.html)" analyzer might work for your simple example, however be sure to get familiar with how [analyzers](https://www.elastic.co/guide/en/elasticsearch/reference/5.1/analysis-analyzers.html) work before proceeding to using this on any larger amount of data, otherwise you might need to reindex later.

The problem with the "simple" analyzer is that it breaks text into terms whenever it encounters a character which is not a letter, so "100" will just end up as an empty string. You can check the behaviour of the build in analyzers with the "\_analyze" endpoint to understand this better:

```auto
POST _analyze
{
  "analyzer": "simple",
  "text": "100"
}

-->

{
  "tokens": []
}

```

```auto
POST _analyze
{
  "analyzer": "standard",
  "text": "100"
}

--->

{
  "tokens": [
    {
      "token": "100",
      "start_offset": 0,
      "end_offset": 3,
      "type": "<NUM>",
      "position": 0
    }
  ]
}

```

---

<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:** [February 28, 2017, 10:56am UTC](https://discuss.elastic.co/t/autosuggestion-for-integer-not-working-in-elastic-search/73329/5 "2017-02-28T10:56:00Z")

</div>

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