I am using elasticsearch 6.1 version and I want to use "Suggester" of its feature. I have dumped data in the format its required for suggester.
I have used these queries.
PUT /hotels
{
"mappings": {
"hotel" : {
"properties" : {
"name" : { "type" : "keyword" },
"city" : { "type" : "keyword" },
"name_suggest" : {
"type" : "completion"
}
}
}
}
}
put hotels/hotel/1
{
"name" : "Mercure Hotel Munich",
"city" : "Munich",
"name_suggest" : "Mercure Hotel Munich"
}
put /hotels/hotel/2
{
"name" : "Hotel Monaco",
"city" : "Munich",
"name_suggest" : "Hotel Monaco"
}
put /hotels/hotel/3
{
"name" : "Courtyard by Marriot Munich City",
"city" : "Munich",
"name_suggest" : "Courtyard by Marriot Munich City"
}
Then I fire my search query that is
Post http://localhost:9200/hotels/_search
{
"suggest": {
"name_suggest": {
"text": "h",
"completion": {
"field": "name_suggest"
}
}
}
}
I get the output result. It only return me the 2 data that is "Hotel Monaco" but it doesn't suggest me "Mercure Hotel Munich" it has hotel.
I want both in my suggest result set I have tried with "prefix" as well.
Has anyone tried it. Please suggest me any solution to it.