# Index Boost along with sort not working

**URL:** <https://discuss.elastic.co/t/index-boost-along-with-sort-not-working/282582>\
**Category:** Elasticsearch\
**Created:** [August 26, 2021, 1:48pm UTC](https://discuss.elastic.co/t/index-boost-along-with-sort-not-working/282582 "2021-08-26T13:48:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nileshsoor](https://avatars.discourse-cdn.com/v4/letter/n/838e76/32.png) [@nileshsoor](https://discuss.elastic.co/u/nileshsoor)\
**Post date:** [August 26, 2021, 1:48pm UTC](https://discuss.elastic.co/t/index-boost-along-with-sort-not-working/282582/1 "2021-08-26T13:48:25Z")

</div>

I have a query, which will fired against 2 indices A & B. Results from index A is more important than B.  
ES version : 7.8.0  
Query::

```auto
{
  "query": {
    "terms": {
      "id": ["a5af38bf-63ac-4e26-af25-68044ffea298","a5af38bf-63ac-4e26-af25-68044ffea298"]
    }
  },
  "sort": [
    {
      "name": "asc"
    }
  ],
  "indices_boost": [
    {
      "A": 1.4
    },
    {
      "B": 1.0
    }
  ]
}

```

But because of sort, results are coming from index B. I need it from A.  
Please help!

Thanks

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 26, 2021, 3:32pm UTC](https://discuss.elastic.co/t/index-boost-along-with-sort-not-working/282582/2 "2021-08-26T15:32:29Z")

</div>

Please use markdown and formatting in your posts, this is really hard to read. This forum fully supports code snippets. Thank you!

If you want to prefer index a, you either should not sort or just execute a multi search with two searches, one against each index and prefer the first result if it exists over the second.

Hope this helps!

---

<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:** [September 23, 2021, 3:48pm UTC](https://discuss.elastic.co/t/index-boost-along-with-sort-not-working/282582/4 "2021-09-23T15:48:19Z")

</div>

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