I need to add a custom analyzer for a field during INDEX but I do not want any analysis done of the search term. I tried looking for an analyzer that would just group the entire search term as a complete phrase, like:
"dummy_analyzer":{
"type":"pattern",
"pattern":"00xyzzy00" <-- a dummy string trying to never separate words
}
I have my field mapped to use my custom analyzer during index and dummy analyzer during search, but I'm not convinced that's working (here is a long description of why I think it's not working).
What is a good (/the right) way to put a custom analyzer on field for INDEX and have the field not analyzed during search?
Sadly, query_string always splits terms on spaces no matter what you put in the analyzer field. That is part of its query language. It just uses the analyzer to analyze the terms. I suspect match query will do what you want though. It doesn't support all of the flexibility that query_string supports but that is generally a good thing.
Its how its always worked and how it will forever work. If you are willing, have a read through the query_string [docs][Query string query | Elasticsearch Guide [8.11] | Elastic] and click the edit button and fix anything that is unclear. I'm not sure I can do it because I'm so used to query_string's quirks that I assume too much when reading the docs.
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.