Constant score query

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

  1. GET /_search
  2. {
  3. "query": {
  4. "constant_score": {
  5. "filter": {
  6. "term": { "user.id": "kimchy" }
  7. },
  8. "boost": 1.2
  9. }
  10. }
  11. }

Top-level parameters for constant_score

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, Elasticsearch 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.