elasticsearch/docs/reference/query-languages/query-dsl/query-dsl-constant-score-query.md
Craig Taverner 94cad286bc
Restructure query-languages docs files for clarity (#124797)
In a few previous PR's we restructured the ES|QL docs to make it possible to generate them dynamically.

This PR just moves a few files around to make the query languages docs easier to work with, and a little more organized like the ES|QL docs.

A bit part of this was setting up redirects to the new locations, so other repo's could correctly link to the elasticsearch docs.
2025-03-17 17:58:58 +01:00

1.3 KiB

navigation_title mapped_pages
Constant score
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-constant-score-query.html

Constant score query [query-dsl-constant-score-query]

Wraps a filter query and returns every matching document with a relevance score equal to the boost parameter value.

GET /_search
{
  "query": {
    "constant_score": {
      "filter": {
        "term": { "user.id": "kimchy" }
      },
      "boost": 1.2
    }
  }
}

Top-level parameters for constant_score [constant-score-top-level-params]

filter
(Required, query object) Filter query you wish to run. Any returned documents must match this query.

Filter queries do not calculate relevance scores. To speed up performance, {{es}} automatically caches frequently used filter queries.

boost
(Optional, float) Floating point number used as the constant relevance score for every document matching the filter query. Defaults to 1.0.