Is it possible to wildcard search AND highlight or name the matching query in the results?

We have about a dozen fields we want to search with wildcards, but we need to know which fields have matched. I've used named queries and highlighting, but I don't believe those work with wildcard searches.

So, when searching for 'john' we want to match first name 'Johnny', last name 'Johnson', and email address 'john123@example.com' and show which of those fields match in each of the hits.

I wonder if explain: true could help you?
Otherwise indeed named queries that you define within a bool query inside a should array would probably be better.

Actually, I just discovered I can add the 'highlight' option to 'query_string' queries. The docs didn't indicate that, but it seems to work. That allow me to use wildcards and shows what fields matched.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.