I've read the document on Synonym Graph, but I am still confused about explicit mapping.
Assume that we have the following data:
horse
mouse
chicken
rooster
duck
cow
Let's assume the synonym file has the following entries:
cow=>duck
I am using Index-time synonyms. I am expecting if I search for cow
, I will only get duck
. If I search for duck
, I will also only get duck
. But that's not the case.
Query: PREFIX query to search for cow
Expected result: duck
only
Actual Result: No result!!
Query: PREFIX query to search for duck
Expected result: duck
only
Actual Result: both cow
and duck
"query": {
"prefix": {
"animal": "cow" (or change it to "duck")
}
}
Why is it that when searching for cow
, I get no results, and when searching for duck
, both cow
and duck
are returned? Is my understanding incorrect?
For good measures, I did MATCH query on cow
and duck
as well. Both returned cow
and duck
. Still not what I was expecting.
"query": {
"match": {
"animal": "cow" (or change it to "duck")
}
}