Prefix query

Prefix query #

Returns documents that contain a specific prefix in a provided field.

Inside a nested query: 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 provided field.
  • case_insensitive
    (Optional, boolean) Allows ASCII case insensitive matching of the value with the indexed field values when set to true. Default is false.
  • 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, …).
Calendar September 27, 2026
Edit Edit this page