# Completion Suggester : Support for numeric value completion suggestion

**URL:** https://discuss.elastic.co/t/completion-suggester-support-for-numeric-value-completion-suggestion/19135
**Category:** Elasticsearch
**Created:** [August 7, 2014, 11:43am UTC](https://discuss.elastic.co/t/completion-suggester-support-for-numeric-value-completion-suggestion/19135 "2014-08-07T11:43:18Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Hemant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hemant/32/1337_2.png) [@Hemant](https://discuss.elastic.co/u/Hemant)
#### Post date: [August 7, 2014, 11:43am UTC](https://discuss.elastic.co/t/completion-suggester-support-for-numeric-value-completion-suggestion/19135/1 "2014-08-07T11:43:18Z")

</div>

Hello,

I was trying the following use cases using completion suggester -

1. Suggest Song on search song by id - numeric value(long) - \*\*\*\*\*\*\*
2. Suggest Song by Song Title and  
some more use cases, but that does not make any sense for this question.

But I was unable to get the first use case done.

I indexed the song as follows -

curl -X PUT 'localhost:9200/music/song/1?refresh=true' -d '{  
"name" : "Nevermind",  
"suggest" : {  
"input": ["Nevermind", "Nirvana", "123"],  
"output": "Nirvana - Nevermind",  
"payload" : { "artistId" : 2321 },  
"weight" : 34  
}  
}'

curl -X PUT 'localhost:9200/music/song/2?refresh=true' -d '{  
"name" : "Friday",  
"suggest" : {  
"input": ["Friday", "Rebecca","1456"],  
"output": "Nirvana - Nevermind",  
"payload" : { "artistId" : 2322 },  
"weight" : 34  
}  
}'

Now when I query -

curl -X POST 'localhost:9200/music/\_suggest?pretty' -d '{  
"song-suggest" : {  
"text" : "123",  
"completion" : {  
"field" : "suggest"  
}  
}  
}'

I expected the following result by the completion search result -

{  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"song-suggest" : [ {  
"text" : "123",  
"offset" : 0,  
"length" : 3,  
"options" : [ {  
"text" : "Nirvana - Nevermind",  
"score" : 34.0, "payload" : {"artistId":2321}  
} ]  
} ]  
}

But did not succeed.

From several attempt came to notice that, numeric value completion  
suggester is not yet supported in Elaticsearch.

After reading few forum posts, and Elasticsearch documentation, noticed  
that this completion suggester is only for terms which consists only  
alphabet, as it is using FST as it's internal data structure.  
Elasticsearch : you-complete-me blog  
[http://www.elasticsearch.org/blog/you-complete-me/](http://www.elasticsearch.org/blog/you-complete-me/) , Search-suggesters-completion  
article  
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html)

Correct me, If I have understood something wrongly.

My question is, Will Elasticsearch be supporting numeric value in near  
future for completion suggester ?  
Or is there any way I can use completion suggester for this purpose ?

Or suggest me some better alternative to solve this problem.

Thanks,  
Hemant

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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: [August 12, 2014, 8:51am UTC](https://discuss.elastic.co/t/completion-suggester-support-for-numeric-value-completion-suggestion/19135/2 "2014-08-12T08:51:35Z")

</div>

Hey,

The default analyzer used in the completion suggester is the simple one,  
which strips out numbers.

--Alex

On Thu, Aug 7, 2014 at 1:43 PM, Hemant [hemant19cse@gmail.com](mailto:hemant19cse@gmail.com) wrote:

> Hello,
> 
> I was trying the following use cases using completion suggester -
> 
> 1. Suggest Song on search song by id - numeric value(long) - \*\*\*\*\*\*\*
> 2. Suggest Song by Song Title and  
> some more use cases, but that does not make any sense for this question.
> 
> But I was unable to get the first use case done.
> 
> I indexed the song as follows -
> 
> curl -X PUT 'localhost:9200/music/song/1?refresh=true' -d '{  
> "name" : "Nevermind",  
> "suggest" : {  
> "input": ["Nevermind", "Nirvana", "123"],  
> "output": "Nirvana - Nevermind",  
> "payload" : { "artistId" : 2321 },  
> "weight" : 34  
> }  
> }'
> 
> curl -X PUT 'localhost:9200/music/song/2?refresh=true' -d '{  
> "name" : "Friday",  
> "suggest" : {  
> "input": ["Friday", "Rebecca","1456"],  
> "output": "Nirvana - Nevermind",  
> "payload" : { "artistId" : 2322 },  
> "weight" : 34  
> }  
> }'
> 
> Now when I query -
> 
> curl -X POST 'localhost:9200/music/\_suggest?pretty' -d '{  
> "song-suggest" : {  
> "text" : "123",  
> "completion" : {  
> "field" : "suggest"  
> }  
> }  
> }'
> 
> I expected the following result by the completion search result -
> 
> {  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "song-suggest" : [ {  
> "text" : "123",  
> "offset" : 0,  
> "length" : 3,  
> "options" : [ {  
> "text" : "Nirvana - Nevermind",  
> "score" : 34.0, "payload" : {"artistId":2321}  
> } ]  
> } ]  
> }
> 
> But did not succeed.
> 
> From several attempt came to notice that, numeric value completion  
> suggester is not yet supported in Elaticsearch.
> 
> After reading few forum posts, and Elasticsearch documentation, noticed  
> that this completion suggester is only for terms which consists only  
> alphabet, as it is using FST as it's internal data structure.  
> Elasticsearch : you-complete-me blog  
> [http://www.elasticsearch.org/blog/you-complete-me/](http://www.elasticsearch.org/blog/you-complete-me/) , Search-suggesters-completion  
> article  
> [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html)
> 
> Correct me, If I have understood something wrongly.
> 
> My question is, Will Elasticsearch be supporting numeric value in near  
> future for completion suggester ?  
> Or is there any way I can use completion suggester for this purpose ?
> 
> Or suggest me some better alternative to solve this problem.
> 
> Thanks,  
> Hemant
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9izOuN02APiS7vtha\_fjbwNJd9%2Be4isquYaBzmNT9HWQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9izOuN02APiS7vtha_fjbwNJd9%2Be4isquYaBzmNT9HWQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Hemant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hemant/32/1337_2.png) [@Hemant](https://discuss.elastic.co/u/Hemant)
#### Post date: [August 12, 2014, 9:10am UTC](https://discuss.elastic.co/t/completion-suggester-support-for-numeric-value-completion-suggestion/19135/3 "2014-08-12T09:10:44Z")

</div>

Thanks Alexander,

It worked with Standard Analyzer. Will look for different analyzers, and  
chose the best which fits the use case.

Thanks,  
Hemant

On Tuesday, August 12, 2014 2:21:48 PM UTC+5:30, Alexander Reelsen wrote:

> Hey,
> 
> The default analyzer used in the completion suggester is the simple one,  
> which strips out numbers.
> 
> --Alex
> 
> On Thu, Aug 7, 2014 at 1:43 PM, Hemant \<[heman...@gmail.com](mailto:heman...@gmail.com) \<javascript:\>\>  
> wrote:
> 
> > Hello,
> > 
> > I was trying the following use cases using completion suggester -
> > 
> > 1. Suggest Song on search song by id - numeric value(long) - \*\*\*\*\*\*\*
> > 2. Suggest Song by Song Title and  
> > some more use cases, but that does not make any sense for this question.
> > 
> > But I was unable to get the first use case done.
> > 
> > I indexed the song as follows -
> > 
> > curl -X PUT 'localhost:9200/music/song/1?refresh=true' -d '{
> > 
> > ```
> > "name" : "Nevermind",
> > 
> > "suggest" : {
> > 
> > "input": ["Nevermind", "Nirvana", "123"],
> > 
> > "output": "Nirvana - Nevermind",
> > 
> > "payload" : { "artistId" : 2321 },
> > 
> > "weight" : 34
> > 
> > }
> > 
> > ```
> > 
> > }'
> > 
> > curl -X PUT 'localhost:9200/music/song/2?refresh=true' -d '{
> > 
> > ```
> > "name" : "Friday",
> > 
> > "suggest" : {
> > 
> > "input": ["Friday", "Rebecca","1456"],
> > 
> > "output": "Nirvana - Nevermind",
> > 
> > "payload" : { "artistId" : 2322 },
> > 
> > "weight" : 34
> > 
> > }
> > 
> > ```
> > 
> > }'
> > 
> > Now when I query -
> > 
> > curl -X POST 'localhost:9200/music/\_suggest?pretty' -d '{
> > 
> > ```
> > "song-suggest" : {
> > 
> > "text" : "123",
> > 
> > "completion" : {
> > 
> > "field" : "suggest"
> > 
> > }
> > }
> > 
> > ```
> > 
> > }'
> > 
> > I expected the following result by the completion search result -
> > 
> > {  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "song-suggest" : [ {  
> > "text" : "123",  
> > "offset" : 0,  
> > "length" : 3,  
> > "options" : [ {  
> > "text" : "Nirvana - Nevermind",  
> > "score" : 34.0, "payload" : {"artistId":2321}  
> > } ]  
> > } ]  
> > }
> > 
> > But did not succeed.
> > 
> > From several attempt came to notice that, numeric value completion  
> > suggester is not yet supported in Elaticsearch.
> > 
> > After reading few forum posts, and Elasticsearch documentation, noticed  
> > that this completion suggester is only for terms which consists only  
> > alphabet, as it is using FST as it's internal data structure.  
> > Elasticsearch : you-complete-me blog  
> > [http://www.elasticsearch.org/blog/you-complete-me/](http://www.elasticsearch.org/blog/you-complete-me/) , Search-suggesters-completion  
> > article  
> > [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html)
> > 
> > Correct me, If I have understood something wrongly.
> > 
> > My question is, Will Elasticsearch be supporting numeric value in near  
> > future for completion suggester ?  
> > Or is there any way I can use completion suggester for this purpose ?
> > 
> > Or suggest me some better alternative to solve this problem.
> > 
> > Thanks,  
> > Hemant
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ab701dd1-0cc7-48dd-b0de-4c8ccc9ef7e3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ab701dd1-0cc7-48dd-b0de-4c8ccc9ef7e3%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:09am UTC](https://discuss.elastic.co/t/completion-suggester-support-for-numeric-value-completion-suggestion/19135/4 "2017-07-06T01:09:18Z")

</div>


