SergeiK
SergeiK

Reputation: 345

wildcards for elasticsearch simple_query_string?

As a result of the following query to the type:

"query": {
     "simple_query_string" : {
          "query" : "RUDVRUMMXXX"
        }
  }

I get 5 hits. RUDVRUMMXXX is the entire text value of some field.

When I try to search with just a bit of its value (e.x. VRUMMXXX, or VRUMMX) elastic finds nothing.

I tried to add wildcard like that:

"query": {
     "simple_query_string" : {
          "query" : "*VRUMMXXX",
          "analyze_wildcard" : true
        }
  }

but get zero result anyway.

also tried this:

"query": {
     "wildcard" : {
          "query" : "*VRUMMXXX"
        }
  }

...same success.

Any help is appreciated.

Upvotes: 2

Views: 1587

Answers (1)

Lax
Lax

Reputation: 1167

Try this:

 { 
   "query": 
      { 
         "query_string" : 
           { 
                 "query" : "*VRUMMXXX"
            } 
       } 
 }

Upvotes: 3

Related Questions