Using synonyms with Auto Suggest - Search won't work , Analyze will


#1

I am using the Kibana Dev Tools Console.
Elastic 6.1.1
Kibana 6.1.1
Running on windows

I am setting up an index with synonyms and auto-suggest:
PUT /hotels
{
"settings": {
"analysis": {
"filter": {
"my_synonym_filter": {
"type": "synonym",
"synonyms": [
"courtyard, marriot"
]
}
},
"analyzer": {
"my_synonyms": {
"tokenizer": "standard",
"filter": [
"lowercase",
"my_synonym_filter"
]
}
}
}
},
"mappings": {
"hotel" : {
"properties" : {
"name" : { "type" : "text" },
"city" : { "type" : "text" },
"name_suggest" : {
"type" : "completion"
}
}
}
}
}

Analyzing using the synonym work
GET /hotels/_analyze
{
"analyzer" : "my_synonyms",
"text" : "I like the Marriot hotel"
}

.... {
"token": "marriot",
"start_offset": 11,
"end_offset": 18,
"type": "",
"position": 3
},
{
"token": "courtyard",
"start_offset": 11,
"end_offset": 18,
"type": "SYNONYM",
"position": 3
},......

However, I am then populating, using a synonym

PUT /hotels/hotel/3
{
"name" : "Courtyard by Marriot Munich City",
"city" : "Munich",
"name_suggest" : {
"input" : [
"Courtyard by Marriot Munich City"
],
"weight": 15
}
}

If I search using auto-complete it will not work
POST /hotels/_search?pretty
{
"suggest" : {
"name_suggest" : {
"prefix" : "m",
"completion": {
"field": "name_suggest"
}
}
}
}

(no hits)


(system) #2

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