How to do wild card search for terms which has special characters in it

I am using the following query

GET indexname/_search
"query" : {
"query_string" : {
"query" : "* 036-192 *",
"default_field" : "partNumber"

Now when I run this query m getting hit as null even though there are documents with 036-192.Looks like it's including * also in the search term because of special character - in 036-192

Any way to sort this out


please take yourself some time and read the Search in depth in the definitive guide to make sure you understand how full text search in Elasticsearch/Lucene works. It is different to SQL or a any regex based search. You can create a specific search (in combination with analysis/mapping on index time), that works much better than any regex based search when you are searching for such kind of ids (i.e. by splitting on dashes only, but using ngrams or edgengram etc, there are a couple of ways to solve this depending your use-case).


Thanks Alex

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