Skip to content

Partial Query

Edit page

This is intended for use with “incremental search” systems, which don’t wait for the user to finish typing their search before displaying an initial set of results. For example, in such a system a user would start typing the query and the system would immediately display a new set of results after each letter keypress, or whenever the user pauses for a short period of time (or some other similar strategy).

This allows for prefix matches, matching any number of trailing characters, so, for instance, "_partial": "wildc" or "wildc**" would match wildcard, wildcarded, wildcards, wildcat, wildcats, etc. A partial applies to the last word of the text, when it has two or more characters, and expands to at most the 50 most frequent terms that start with it (in this text the matches are also kept as the word itself). "wildc*" is a Wildcard Query instead: it is not capped.

SEARCH /bank/
{
"_query": {
"favoriteFruit": {
"_partial": "ba"
}
}
}

Using the suffix ** on the last word is equivalent to using _partial

SEARCH /bank/
{
"_query": {
"favoriteFruit": "ba**"
}
}