=================
If this is caused by wrong setting of search.allow_expensive_queries, how do I check what is current value and where do I set this to true?
Could you paste the mapping of the name text field and if it is using any custom analyzers? Also a sample document?
I suspect this is an analysis issue. The match query will pass the query text through the same analyzer that was used to index the document, which means input and output likely match. The wildcard query is a non-analyzed query, meaning it searches the index for exactly the text that you provide.
In practice, most text fields have some kind of analyzer that lowercases, removes punctuation, tokenizes on white space, etc etc. That means a document might have the text ABCD, but after analysis it is stored as abcd.
The match query will perform this same analysis, and "ABCD" -> "abcd" which matches.
In contrast, the wildcard query does no analysis, so it is looking for "AB", any number of characters, followed by "D". This doesn't exist in the index because the document was stored as "abcd", so the query fails to match
I'm not sure that is what's happening, but something along that lines is most likely.
Analyzed vs non-analyzed is a tricky thing that catches a lot of people up. In the docs, anything that is a Fulltext query will be analyzed with the configured analyzer (which tends to make them more "user-friendly" for query bars and end-users, etc)... while pretty much all the other queries are non-analyzed and looking at byte-for-byte matches in the index.
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.