Returns documents that contain a specific prefix in a provided field.
The following search returns documents where the user.id
field contains a term that begins with ki
.
GET /_search
{ "query": { "prefix": { "user.id": { "value": "ki" } } } }
<field>
value
<field>
.
rewrite
rewrite
parameter.
case_insensitive
Added in 7.10.0
This parameter was added in 7.10.0.
(Optional, Boolean) Allows ASCII case insensitive matching of the value with the indexed field values when set to true. Default is false which means the case sensitivity of matching depends on the underlying fieldâs mapping.
You can simplify the prefix
query syntax by combining the <field>
and value
parameters. For example:
GET /_search
{ "query": { "prefix" : { "user" : "ki" } } }
You can speed up prefix queries using the index_prefixes
mapping parameter. If enabled, Elasticsearch indexes prefixes in a separate field, according to the configuration settings. This lets Elasticsearch run prefix queries more efficiently at the cost of a larger index.
Prefix queries will not be executed if search.allow_expensive_queries
is set to false. However, if index_prefixes
are enabled, an optimised query is built which is not considered slow, and will be executed in spite of this setting.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4