Hi,
I have an analyzer which contains a synonym filter:
analysis: {
analyzer: {
synonym_brazilian_analyzer: {
tokenizer: "standard",
filter: [
"lowercase",
"asciifolding",
"my_synonyms",
"brazilian_stop"
]
}
},
filter: {
brazilian_stop: {
type: "stop",
stopwords: "_brazilian_"
},
my_synonyms: {
type: "synonym",
synonyms_path: "path/synonyms.txt"
}
}
}
My path/synonyms.txt contains:
shirt, blouse
My query is
query: {
multi_match: {
fields: %w(name^3
tags_names^2),
query: term,
fuzziness: "AUTO"
}
}
I have documents which contain the word 'shirt' in the tags_names field and others documents, the word 'shirts' in the same field.
If I search for 'shirts', because of the 'fuzziness' setting, both documents containing 'shirt' and 'shirts' are retrieved. However, if I search for 'shirt', only the documents with 'shirt' are returned.
Removing the
shirt, blouse
from my synonym setting file, both queries return the same documents.
Why does it happen when I search for a word which is described in my synonym setting file? Doesn't elasticsearch allow fuzzy searches on words declared in a synonym file?
How do I deal with that? Can't I use them (fuzziness and synonym) simultaneously when I am searching for a term defined in the synonym file?
Thanks,
Guilherme