Hi all,
I am using elastic to do some fuzzy searches on few indexed text fields, so far so good.
My question: I would like to limit the results as follows:
Let's say that the user searches "mytext":
if "mytext" is not an exact match on any indexed field --> go for the usual fuzzy search
if on the contrary "mytext" is found exactly in one field --> display only that records and skip all the "fuzzy" ones
I have read the multi_match docs but I have had no luck... Anyone willing to help?
Many thanks!
Luigi
You would have to implement this "retry if no matches" logic in your client application.
Elasticsearch is designed to be a distributed system so the query execution logic on one node doesn't know if another node might have found a match for mytext or not.
Your client could issue one msearch request containing a strict and lax version of the searches and only use the lax results if the strict result was empty. That might be more expensive (needlessly running some lax searches) but would mean your client makes only one request.
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.