Prefix query #
Returns documents that contain a specific prefix in a provided field.
Inside a
nestedquery: not supported yet — the clause is rejected with an HTTP 400 naming the offending clause.
Examples #
The following search returns documents where the org.id field contains a term
that begins with inf.
GET /_search
{
"query": {
"prefix": {
"field": "org.id",
"value": "inf"
}
}
}
Parameters for prefix
#
field
(Required, string) Field you wish to search.value
(Required, string) Beginning characters of terms you wish to find in the providedfield.case_insensitive
(Optional, boolean) Allows ASCII case insensitive matching of the value with the indexed field values when set totrue. Default isfalse.boost
(Optional, float, default:1.0) Decrease or increase the relevance scores of the query.rewrite
(Optional, string) Method used to rewrite the expanded terms (constant_score,scoring_boolean,top_terms_N, …).