Completion Suggester : Support for numeric value completion suggestion


(Hemant) #1

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/ , Search-suggesters-completion
article
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Alexander Reelsen) #2

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 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/ , Search-suggesters-completion
article
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.
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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9izOuN02APiS7vtha_fjbwNJd9%2Be4isquYaBzmNT9HWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Hemant) #3

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 <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/ , Search-suggesters-completion
article
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 <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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ab701dd1-0cc7-48dd-b0de-4c8ccc9ef7e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4