# Put a certain result at the top, then order all the rest

**URL:** https://discuss.elastic.co/t/put-a-certain-result-at-the-top-then-order-all-the-rest/56443
**Category:** Elasticsearch
**Created:** [July 26, 2016, 7:53pm UTC](https://discuss.elastic.co/t/put-a-certain-result-at-the-top-then-order-all-the-rest/56443 "2016-07-26T19:53:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jamilnyc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jamilnyc/32/8991_2.png) [@jamilnyc](https://discuss.elastic.co/u/jamilnyc)
#### Post date: [July 26, 2016, 7:53pm UTC](https://discuss.elastic.co/t/put-a-certain-result-at-the-top-then-order-all-the-rest/56443/1 "2016-07-26T19:53:50Z")

</div>

In MySQL it is possible to put a specific record at the top/bottom of results by using `ORDER BY document_id = 123 DESC`.

Is this possible in Elasticsearch version 1.6?

I am doing a search for documents that match a term, and I want one of the documents with a particular field value to always appear at the top of the list, regardless of relevance, etc. The remainder of the documents, will appear in their default sort order right after wards.

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [July 26, 2016, 8:20pm UTC](https://discuss.elastic.co/t/put-a-certain-result-at-the-top-then-order-all-the-rest/56443/2 "2016-07-26T20:20:11Z")

</div>

You can try my plugin

> **[jprante/elasticsearch-functionscore-conditionalboost](https://github.com/jprante/elasticsearch-functionscore-conditionalboost)**
>
> elasticsearch-functionscore-conditionalboost - Boost documents in Elasticsearch when they match dynamic conditions

The idea is to give an extra boost to all docs that match a given term with the help of function scoring. If your top doc has a special value which is unique, you can configure a ridiculous high boost value to achieve the desired effect.

I do not recommend 1.6 - please stop using it, also for security purpose [https://www.elastic.co/community/security](https://www.elastic.co/community/security)

Please update to 1.7+ or 2.+ as soon as possible.

---

<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:32pm UTC](https://discuss.elastic.co/t/put-a-certain-result-at-the-top-then-order-all-the-rest/56443/3 "2017-07-05T22:32:42Z")

</div>


