Completion Suggestion Not working as documented


(Madhavan Ramachandran) #1

Hi All,

I am new to Elastic Search. I try to implement the completion suggester as
documented in "http://www.elasticsearch.org/blog/you-complete-me/" with
sample data as below. Instead of hotel.. i choose region and locations..

us-en-us-chicago
us-en-us-chicago, central loop
us-en-us-chicago, east loop
us-en-us-chicago, eastern east-west
us-en-us-chicago, i-80 & i-55 corridors
us-en-us-chicago, i-90 corridor
us-en-us-chicago, north (cook county)
us-en-us-chicago, north (lake county)
us-en-us-chicago, north i-94 corridor
us-en-us-chicago, north michigan avenue
us-en-us-chicago, northwest
us-en-us-chicago, northwest indiana
us-en-us-chicago, o'hare
us-en-us-chicago, river north
us-en-us-chicago, west loop
us-en-us-chicago, western east-west

I am using POSTMAN, a chrome extension to create and query from Elastic
Search. I created Index using POSTMAN tool

PUT : http://localhost/typeahead
{
"mappings": {
"search" : {
"properties" : {
"search" : {
"type" : "completion"
}
}
}
}
}

Indexed the above content as

PUT : http://localhost/typeahead/search/1

{
"search" : {
"input" : "us-en-us-chicago"
}
}

After indexing all the above data, verified the data using search. It
returns the total "text" as indexed.
When I ran the query for suggest. (see below for the query and results).
I am getting only 5 results out of it. Is this the expected behavior of
completion suggester in ES? Or do i need to use different tool ?

Any suggestions are appreciated.

Suggest query:
{
"my-suggest" : {
"text" : "us-en-us-chi",
"completion" : {
"field" : "search"
}
}
}

and results as
{
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"my-suggest": [
{
"text": "us-en-us-chi",
"offset": 0,
"length": 12,
"options": [
{
"text": "us-en-us-chicago",
"score": 1
},
{
"text": "us-en-us-chicago, central loop",
"score": 1
},
{
"text": "us-en-us-chicago, east loop",
"score": 1
},
{
"text": "us-en-us-chicago, eastern east-west",
"score": 1
},
{
"text": "us-en-us-chicago, i-80 & i-55 corridors",
"score": 1
}
]
}
]
}

Kind Regards
Madhavan.TR

--
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/9a259863-c10e-43c2-91d7-699c48868f8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Alexander Reelsen) #2

hey,

you can configure the count of the retured elements using the "size"
parameter, see
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters.html#search-suggesters
or the examples
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/suggester-context.html

--Alex

On Fri, Aug 1, 2014 at 6:18 PM, Madhavan Ramachandran madhavtr@gmail.com
wrote:

Hi All,

I am new to Elastic Search. I try to implement the completion suggester as
documented in "http://www.elasticsearch.org/blog/you-complete-me/" with
sample data as below. Instead of hotel.. i choose region and locations..

us-en-us-chicago
us-en-us-chicago, central loop
us-en-us-chicago, east loop
us-en-us-chicago, eastern east-west
us-en-us-chicago, i-80 & i-55 corridors
us-en-us-chicago, i-90 corridor
us-en-us-chicago, north (cook county)
us-en-us-chicago, north (lake county)
us-en-us-chicago, north i-94 corridor
us-en-us-chicago, north michigan avenue
us-en-us-chicago, northwest
us-en-us-chicago, northwest indiana
us-en-us-chicago, o'hare
us-en-us-chicago, river north
us-en-us-chicago, west loop
us-en-us-chicago, western east-west

I am using POSTMAN, a chrome extension to create and query from Elastic
Search. I created Index using POSTMAN tool

PUT : http://localhost/typeahead
{
"mappings": {
"search" : {
"properties" : {
"search" : {
"type" : "completion"
}
}
}
}
}

Indexed the above content as

PUT : http://localhost/typeahead/search/1

{
"search" : {
"input" : "us-en-us-chicago"
}
}

After indexing all the above data, verified the data using search. It
returns the total "text" as indexed.
When I ran the query for suggest. (see below for the query and results)
.
I am getting only 5 results out of it. Is this the expected behavior of
completion suggester in ES? Or do i need to use different tool ?

Any suggestions are appreciated.

Suggest query:
{
"my-suggest" : {
"text" : "us-en-us-chi",
"completion" : {
"field" : "search"
}
}
}

and results as
{
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"my-suggest": [
{
"text": "us-en-us-chi",
"offset": 0,
"length": 12,
"options": [
{
"text": "us-en-us-chicago",
"score": 1
},
{
"text": "us-en-us-chicago, central loop",
"score": 1
},
{
"text": "us-en-us-chicago, east loop",
"score": 1
},
{
"text": "us-en-us-chicago, eastern east-west",
"score": 1
},
{
"text": "us-en-us-chicago, i-80 & i-55 corridors",
"score": 1
}
]
}
]
}

Kind Regards
Madhavan.TR

--
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/9a259863-c10e-43c2-91d7-699c48868f8e%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/9a259863-c10e-43c2-91d7-699c48868f8e%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/CAGCwEM9hUm0bjJRm_Mm21GPLxcAfqZGoW6%3DTGO8px0UKeN%2BM%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3