# Constant Score 查询

原文链接 : [https://www.elastic.co/guide/en/elasticsearch/reference/5.0/query-dsl-constant-score-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/query-dsl-constant-score-query.html)

译文链接 : [http://www.apache.wiki/pages/viewpage.action?pageId=4882886](http://www.apache.wiki/pages/viewpage.action?pageId=4882886)

贡献者 : [蓝色飞扬](/display/~lixiaoqing)

** [&lt;&lt; Compound queries](/pages/viewpage.action?pageId=4882469)                                                                                                                     [Bool  Query &gt;&gt;](http://www.apache.wiki/pages/viewpage.action?pageId=4882896)**

* * *

此查询可对另一个查询进行包装，并简单地返回一个与该过滤器中每个文档的查询提升相等的常量分数， 映射到 **Lucene **即为 **ConstantScoreQuery **。

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

* * *

** [&lt;&lt; Compound queries](/pages/viewpage.action?pageId=4882469)                                                                                                                     [Bool  Query &gt;&gt;](http://www.apache.wiki/pages/viewpage.action?pageId=4882896)**