_reindex and a random_score query


#1

Hi everybody!

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

POST /_reindex

{
  "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? :slight_smile:

Thank you!


(Nik Everett) #2

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


(avencar) #3

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?


(Nik Everett) #4

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


(Nik Everett) #5

(Nik Everett) #6

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 . They'll get updated in half an hour or so, I believe.


(Nik Everett) #7

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.


(system) #8