I'm looking for a way to tell elasticsearch that "no added sugar" and "added sugar" are separate phrases and should be indexed accordingly. I do not want them to conflate or conflict with each other.
Docs example:
"Cola No Added Sugar"
"Pepsi Added Sugar"
At the moment, when I search "added sugar", I get results that include "no added sugar". I've looked at various ways to acheive this including synomyms but I'm struggling.
How would I go about achieving this? Any advice is much appreciated.
@Alan88 If you want to match your "product_name" as a keyword (exact match), then you must index it as "keyword" in your mapping and use Term query instead of Match query.
A match query behaves depending one the Analyzer/Tokenizer being in action. "Sugar" will match "Cola No Added Sugar" in your example.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.