so this query will find super_name, but not "super name 1" - I think because of the analyzer. I could change the mapping but I'm not sure if this not disturb the search of "name" field. So I could use match + should, but I don't feel this right approach:
I would copy the "name" field into a field called "name.raw", where you use this field for filtering and aggregations. This is done in your mappings and a re-index operation.
It the one solution that I was thinking about, but I am sure if like duplication of the data (Am I right?). But indeed I want to have field that is analyzed some times and some times not analyzed.
Why is it better than creation of multiple matches + should in DSL query?
I prefer solutions where the complete query is as simple as possible as these queries are scaling better. So if your indices are small, then go for both approaches and see what suites you best.
That said, I would prefer not to mingle with an analyzer, that's works for your basic search cases unless I do have the time needed to do it properly. This is a time consuming task.
If you are using ES v. 5.X, then this blog presents the idea about how to organize text for both classic full-text search and keyword search as you are needing in your case.
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.