Wildcard Query
Edit pageMatches documents that have fields matching a wildcard expression. Supported
wildcards are *, which matches any character sequence (including the empty
one), and ?, which matches any single character. A * at the end of a word is a prefix
match. A * or ? inside a word, or a ? anywhere, is a pattern and needs the _wildcard
modifier; a ? that ends the word stays a literal character. Note that this query can be
slow, as it needs to iterate over many terms, and it is not capped: the number of terms
it expands to has no limit. A wildcard term that starts with one of the wildcards * or
? is not refused, but it has no literal prefix and scans the whole term dictionary, so
avoid it.
This allows for prefix matches, matching any number of trailing characters, so,
for instance, "wildc*" would match wildcard, wildcarded,
wildcards, wildcat, wildcats, etc.
Example
Section titled “Example”SEARCH /bank/
{ "_query": { "favoriteFruit": { "_wildcard": "ba" } }}A similar effect could be obtained by using the wildcard (“*”) character
as part of the query text:
SEARCH /bank/
{ "_query": { "favoriteFruit": "ba*" }}