# Score results based in a list of ids

**URL:** <https://discuss.elastic.co/t/score-results-based-in-a-list-of-ids/149377>\
**Category:** Elasticsearch\
**Created:** [September 21, 2018, 2:14am UTC](https://discuss.elastic.co/t/score-results-based-in-a-list-of-ids/149377 "2018-09-21T02:14:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cesaribeiro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cesaribeiro/32/35744_2.png) [@cesaribeiro](https://discuss.elastic.co/u/cesaribeiro)\
**Post date:** [September 21, 2018, 2:14am UTC](https://discuss.elastic.co/t/score-results-based-in-a-list-of-ids/149377/1 "2018-09-21T02:14:15Z")

</div>

Hello guys!  
This is my first time using ElasticSearch so I'm sorry if I missed any documentation.  
So I'm trying to setup a query that will prioritize the document's whose id is in a .txt file that I have. What is the best aproach to do that? Should I upload these ids to a different index and compare them?

Here's what I have so far:

```
GET users/_search
{
  "query": {
    "function_score": {
      "query": { "match_all": {} },
      "boost": "5",
      "functions": [
        {
          "filter": {
            "terms" :{
              "_id": [
                id1,
                id2,
                id3,
                ...
              ]
            }
          },
          "weight": 2
        }
      ],
      "boost_mode":"multiply"
    }
  }
}

```

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)\
**Post date:** [September 28, 2018, 9:15pm UTC](https://discuss.elastic.co/t/score-results-based-in-a-list-of-ids/149377/2 "2018-09-28T21:15:32Z")

</div>

> Should I upload these ids to a different index and compare them?

There is no way in elasticsearch to do queries across multiple indexes. You best choice is to list ids the way you are doing it.

---

<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:** [October 26, 2018, 9:15pm UTC](https://discuss.elastic.co/t/score-results-based-in-a-list-of-ids/149377/3 "2018-10-26T21:15:41Z")

</div>

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