I drafted are email for synonym multi word issue.
If I want search "lol" to get results has "lol" and "laughing out loud".
My index setting:
PUT /synonym_index
{
"settings": {
"analysis" : {
"analyzer" : {
"my_analyzer" : {
"tokenizer" : "whitespace",
"filter" : ["my_stemmer","synonym"]
}
},
"filter" : {
"my_stemmer" : {
"type" : "stemmer",
"name" : "english"
},
"synonym": {
"type" : "synonym_graph",
"synonyms" : [
"lol, laughing out loud",
"universe, cosmos"
` ]
}
}
}
}
}
input:
GET synonym_index/_analyze?pretty
{
"analyzer" : "my_analyzer",
"text" : "lol"
}
want:
{
"tokens" : [
{
"token" : "laughing out loud",
"start_offset" : 0,
"end_offset" : 3,
"type" : "SYNONYM",
"position" : 0
},
{
"token" : "lol",
"start_offset" : 0,
"end_offset" : 3,
"type" : "word",
"position" : 0,
"positionLength" : 3
}
]
}
But the search results is not what I want. If document have "laughing", "lol", "out" or "loud" will be return. I just want to get have "lol" or "laughing out loud" documents.
So, what can I need to do? Thanks.