Query string query

Query string query #

Returns documents that match a compact query-syntax string, e.g. status:active AND title:search. The same parser powers the URI search parameter ?q=.

Inside a nested query: not supported yet — the clause is rejected with an HTTP 400 naming the offending clause.

Examples #

POST /my-collection/_search
{
  "query": {
    "query_string": {
      "query": "status:active AND title:search"
    }
  }
}

Across several fields with per-field boosts:

POST /my-collection/_search
{
  "query": {
    "query_string": {
      "query": "search engine",
      "fields": ["title^3", "description"]
    }
  }
}

Parameters for query_string #

  • query
    (Required, string) The query-syntax string.
  • default_field
    (Optional, string, default: *) Field used for bare terms when fields is empty.
  • default_operator
    (Optional, string, default: or) Default boolean operator between terms: or or and.
  • fields
    (Optional, array of strings) Multiple fields with optional boost (e.g. ["title^3", "description"]). When non-empty, the query is expanded into a bool.should across these fields; each entry supports the field^boost syntax.
  • type
    (Optional, string) Multi-field scoring strategy: best_fields (max/dis_max) or most_fields (sum — the default, for backward compatibility).
  • tie_breaker
    (Optional, float, default: 0) Tie-breaker for best_fields mode: max_score + tie_breaker * sum(other_scores). Range [0, 1].
  • combination_strategy
    (Optional, string) Multi-field score combination for fields: best_fields (max/dis_max) or most_fields (sum). Defaults to most_fields.
Calendar September 27, 2026
Edit Edit this page