FoKycHuK
FoKycHuK

Reputation: 309

Wildcard queries in field name

I can use simple wildcard query like this:

"wildcard" : { "user" : "ki*y" }

but if i want to use wildcard in field, then what? How shoud look valid query for this:

"wildcard" : { "base/*" : "value" }

Upvotes: 16

Views: 21052

Answers (1)

Andrei Stefan
Andrei Stefan

Reputation: 52368

You can use query_string which allows both field names wildcards and query text wildcards.

Something around these lines:

{
  "query": {
    "query_string": {
      "fields": [
        "base*"
      ],
      "query": "ki*y"
    }
  }
}

Upvotes: 37

Related Questions