I am trying to disable fuzziness in my ElasticSearch query. The issue is that a search for medication returns lots of hits for medical. My query is below. The fuzzy_max_expansions arg doesn't have any effect. If I add a fuzziness arg it breaks the query altogether.
I am using Wordpress and Elasticpress to query elasticsearch.
@spinscale
Setting the flags to AND|OR|PHRASE does not change behavior.
A search for medication still returns medical.
I am assuming this is a fuzziness effect, but I can't find a way to modify these results.
can you share fully reproducible example including the mapping. I just want to make sure there is no stemmer involved, that stems the words down to their root forms, which would mean, that each of those terms would match independent from any fuzzy match.
Also adding explain: true should give you a first indiccation what terms are actually searched for. Another good hint is to use the analyze API to understand how your terms are modified before being stored.
Thanks Alex. This project is behind a firewall, so I don't think you will be able to reproduce it. I will certainly look at the analyzer and see if there is a stemmer involved. Where does explain go?
I solved this by filtering the elasticpress mappings. The issue was the ewp_snowball filter.
function remove_snowball( $mapping ) {
unset( $mapping['settings']['analysis']['analyzer']['default']['filter'][4] );
}
add_filter( 'ep_config_mapping', 'remove_snowball', 10, 2 );
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.