# How to use the Rank Features Query to explicitly sort some products

**URL:** <https://discuss.elastic.co/t/how-to-use-the-rank-features-query-to-explicitly-sort-some-products/181679>\
**Category:** Elasticsearch\
**Created:** [May 18, 2019, 12:23pm UTC](https://discuss.elastic.co/t/how-to-use-the-rank-features-query-to-explicitly-sort-some-products/181679 "2019-05-18T12:23:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EFJunior](https://avatars.discourse-cdn.com/v4/letter/e/77aa72/32.png) [@EFJunior](https://discuss.elastic.co/u/EFJunior)\
**Post date:** [May 18, 2019, 12:23pm UTC](https://discuss.elastic.co/t/how-to-use-the-rank-features-query-to-explicitly-sort-some-products/181679/1 "2019-05-18T12:23:08Z")

</div>

I'm trying to explicitly put some documents on the top of some query results. After searching a while, apparently the most suitable tool to achieve it is using the rank features datatype. Although i didn't figured out how to make it explicit. For example :

```
PUT my_index/_doc/1 
{ 
    "topics": {
        "politics" : 1,
        "economics" : 2
   }
}

PUT my_index/_doc/2
{ 
    "topics": {
        "politics" : 2,
        "economics" : 1
    }
}

```

With those documents, when the query is "politics" i'd like to make the doc1 the first result and the doc2 the second, **independently of their score**. And when the query is "economics", the doc2 would be the first and the doc1 the second.

Is it possible to achieve this with the rank features datatype ? If not, what would be your recommendation ?

---

<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:** [June 15, 2019, 12:23pm UTC](https://discuss.elastic.co/t/how-to-use-the-rank-features-query-to-explicitly-sort-some-products/181679/2 "2019-06-15T12:23:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
