Match Wildcard Fallback


(Callum Hopkins) #1

Does anyone know if it's possible to run a bool query with match conditions and if no results are found, run a new bool query but with wildcard conditions? Can I achieve this by adding wildcard conditions to the should bool query weighting match conditions higher than the wildcard conditions to ensure match results have more relevance?

Looks for a contingency to ensure as many searches as possible come back with a result (even if it's a vague result), rather than come back empty with no result


(Nik Everett) #2

If you use a should clause it'll always execute the wildcard query which is
much slower than the normal query. The simplest thing is just to run a
wildcard if you don't get the results that you wanted in your application.
Its slower for those users but puts less load on the system overall.


(system) #3