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.
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.