# How to set doc a score(boost)

**URL:** <https://discuss.elastic.co/t/how-to-set-doc-a-score-boost/51500>\
**Category:** Elasticsearch\
**Created:** [June 1, 2016, 1:21am UTC](https://discuss.elastic.co/t/how-to-set-doc-a-score-boost/51500 "2016-06-01T01:21:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fly365](https://avatars.discourse-cdn.com/v4/letter/f/977dab/32.png) [@Fly365](https://discuss.elastic.co/u/Fly365)\
**Post date:** [June 1, 2016, 1:21am UTC](https://discuss.elastic.co/t/how-to-set-doc-a-score-boost/51500/1 "2016-06-01T01:21:20Z")

</div>

Use solr to set the boost, but ES did not find can set boost, please help about this question,thanks!

bulkRequest.add(client.prepareIndex("twitter", "tweet", "8")  
.setSource(XContentFactory.jsonBuilder()  
.startObject()  
.field("user", "tom")  
.field("postDate", new Date())  
.field("message", "score")  
.endObject()));

SolrInputDocument solrDoc = new SolrInputDocument();  
[//solrDoc.setDocumentBoost](https://solrDoc.setDocumentBoost)(documentBoost);

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [June 1, 2016, 10:37am UTC](https://discuss.elastic.co/t/how-to-set-doc-a-score-boost/51500/2 "2016-06-01T10:37:38Z")

</div>

Document level boost used to be supported via the `_boost` field, but has been deprecated. Here's an explanation why and a way to archive the desired effect using a `function_score` query: [https://www.elastic.co/guide/en/elasticsearch/reference/1.7/mapping-boost-field.html](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/mapping-boost-field.html)

---

<div class="post-metadata">

**Author:** ![Fly365](https://avatars.discourse-cdn.com/v4/letter/f/977dab/32.png) [@Fly365](https://discuss.elastic.co/u/Fly365)\
**Post date:** [June 24, 2016, 6:49am UTC](https://discuss.elastic.co/t/how-to-set-doc-a-score-boost/51500/3 "2016-06-24T06:49:43Z")

</div>

thanks a lot，at this time ,i used setBoot in query,dot set boost when insert a document .thank you very much!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:40pm UTC](https://discuss.elastic.co/t/how-to-set-doc-a-score-boost/51500/4 "2017-07-05T22:40:51Z")

</div>


