Can we score the original string and synonyms equally in elasticsearch.
For eg. I created my synonyms file as:
pvt, private
ltd, limited
I created an index using synonym token filter. Then I indexed two documents:
curl -XPOST "http://localhost:9200/test1/test?pretty" -d
'{ "entityName" : "ABC International Pvt Ltd"}'
curl -XPOST "http://localhost:9200/test1/test?pretty" -d
'{ "entityName" : "ABC International Private Limited"}'
Now when I search "ABC International Pvt Ltd", it scores the first document as 1.15 and second document as 0.57.
Is there a way to treat the synonyms equally?
Created index using following settings:
curl -XPUT 'localhost:9200/test1?pretty' -H 'Content-Type: application/json' -d'
{
"settings" : {
"index" : {
"analysis":{
"analyzer":{
"my_analyzer":{
"tokenizer":"standard",
"filter":["asciifolding", "standard", "lowercase", "my_metaphone", "synonym"]
}
},
"filter":{
"my_metaphone":{
"type":"phonetic",
"encoder":"metaphone",
"replace":false
},
"synonym" : {
"type" : "synonym",
"synonyms_path" : "synonyms.txt",
"ignore_case" : "true"
}
}
}
}
}
}'