A wildcard is a pattern operator that stands for variable characters. In Elasticsearch, it selects groups of index names or matches terms within indexed fields. section 6.3.1 section 9.7
Use two wildcard characters for different matching behavior:
- * matches zero or more characters, so god* finds terms beginning with god and g*d can match Good or God. section 9.7
- ? matches exactly one character, so go?ather matches a word with one character in that position; multiple question marks can be combined. section 9.7
Search movie titles with a wildcard
GET movies/_search { "query": { "wildcard": { "title": { "value": "god*" } } } } The query can return The Godfather, The Godfather II, and City of God. Because wildcard queries are term-level queries, they are not analyzed; the lowercase value matches the lowercase terms produced by the standard analyzer. On a keyword field, use the complete stored form, such as "The God*" on title.original. section 9.7
Select index configurations by pattern
GET ca* This request retrieves configurations for every index beginning with ca. Multiple patterns can be comma-separated, as in GET mov*,stu*, without spaces after commas. section 6.3.1
Listing 9.15 Wildcard search in action
GET movies/_search
{
"query": {
"wildcard": { #1
"title": {
"value": "god*" #2
}
}
}
}
Inspect the complete REST request for a wildcard search against the movies index. section 9.7
Wildcards can make live searches expensive. Search behavior also depends on field mapping: analyzed text fields require the matching analyzed term, whereas keyword fields preserve the original value. Elasticsearch also provides wildcard as a keyword-family data type for suitable structured or pattern-oriented fields. section 9.7 section 4.4







