# \_reindex and a random\_score query

**URL:** <https://discuss.elastic.co/t/-reindex-and-a-random-score-query/50198>\
**Category:** Elasticsearch\
**Created:** [May 17, 2016, 8:58am UTC](https://discuss.elastic.co/t/-reindex-and-a-random-score-query/50198 "2016-05-17T08:58:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jetnet](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jetnet](https://discuss.elastic.co/u/jetnet)\
**Post date:** [May 17, 2016, 8:58am UTC](https://discuss.elastic.co/t/-reindex-and-a-random-score-query/50198/1 "2016-05-17T08:58:14Z")

</div>

Hi everybody!

I've encountered an issue with the random score function when using the " **\_reindex**" command:

POST /\_reindex

```auto
{
  "size": 100,
  "source": {
    "index": "logstash-*",
    "query": {
      "function_score" : {
        "query" : { "match_all": {} },
        "random_score" : {}
      }
    }
  },
  "dest": {
    "index": "random-1"
  }
}
```

if you repeat the query several times for different destinations, then the result sets from the " **random-_X_**" indices are always the same, they are not random.  
A bug or a feature? 🙂

Thank you!

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [May 17, 2016, 12:05pm UTC](https://discuss.elastic.co/t/-reindex-and-a-random-score-query/50198/2 "2016-05-17T12:05:52Z")

</div>

Weird! I'll have a look when I get a chance!

---

<div class="post-metadata">

**Author:** ![avencar](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@avencar](https://discuss.elastic.co/u/avencar)\
**Post date:** [November 9, 2016, 4:11pm UTC](https://discuss.elastic.co/t/-reindex-and-a-random-score-query/50198/3 "2016-11-09T16:11:16Z")

</div>

We are experiencing the same issue. Seems like the function\_score queries don't work at all with the Reindex API. I even tried forcing a sort on "\_score" but no luck.

Any idea what the issue is and if there is a plan for a fix?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [November 9, 2016, 4:26pm UTC](https://discuss.elastic.co/t/-reindex-and-a-random-score-query/50198/4 "2016-11-09T16:26:55Z")

</div>

> [@avencar](#):
>
> Any idea what the issue is and if there is a plan for a fix?

And I totally forgot about this. I'll open an issue.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [November 9, 2016, 4:29pm UTC](https://discuss.elastic.co/t/-reindex-and-a-random-score-query/50198/5 "2016-11-09T16:29:37Z")

</div>

> <https://github.com/elastic/elasticsearch/issues/21432>

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [November 10, 2016, 9:26pm UTC](https://discuss.elastic.co/t/-reindex-and-a-random-score-query/50198/6 "2016-11-10T21:26:08Z")

</div>

I posted a working example in the bug and added some docs to [https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) . They'll get updated in half an hour or so, I believe.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [November 10, 2016, 9:32pm UTC](https://discuss.elastic.co/t/-reindex-and-a-random-score-query/50198/7 "2016-11-10T21:32:41Z")

</div>

It looks like this doesn't work in 2.x, at least not in 2.3.4. I don't _think_ this is a high priority thing to fix in 2.x though so I suspect it'll remain a "known issue" with that version.

---

<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:05pm UTC](https://discuss.elastic.co/t/-reindex-and-a-random-score-query/50198/8 "2017-07-05T22:05:56Z")

</div>


