I am trying to implement Multi-Word Synonyms
This is the index setting
{
"settings": {
"analysis": {
"filter": {
"synonym_filter": {
"type": "synonym_graph",
"synonyms": [
"roti making machine, bread making machine => chapati making machine",
"chapati making machine => phulka making machine",
"bread machine, bread pressing machine => bread making machine"
]
}
},
"analyzer": {
"custom_analyzer": {
"tokenizer": "standard",
"filter": ["lowercase", "synonym_filter"]
}
}
}
},
"mappings": {
"properties": {
"name": {
"type": "text",
"analyzer": "custom_analyzer"
}
}
}
}
These are the sample documents
{"index":{}}
{"name":"Roti Making Machine"}
{"index":{}}
{"name":"Bread Pressing Machine"}
{"index":{}}
{"name":"Chapati Making Machine"}
When I search for "Roti Making Machine", I get this
Search Query:
{
"query": {
"match": {
"name": "Roti Making Machine"
}
}
}
Search Results:
{
"took": 12,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 3,
"relation": "eq"
},
"max_score": 1.2478919,
"hits": [
{
"_index": "product",
"_id": "UJcRBYwBN6t5MCbzznDr",
"_score": 1.2478919,
"_source": {
"name": "Roti Making Machine"
}
},
{
"_index": "product",
"_id": "UZcRBYwBN6t5MCbzznDr",
"_score": 0.26706278,
"_source": {
"name": "Bread Pressing Machine"
}
},
{
"_index": "product",
"_id": "UpcRBYwBN6t5MCbzznDr",
"_score": 0.26706278,
"_source": {
"name": "Chapati Making Machine"
}
}
]
}
}
Ideally, the first result that I should get is "Chapati Making Machine", because it is the synonym of the searched term. Can anyone please help me identify what is the issue?