Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch reindex api deleting document after copy

Tags:

I've gone through the _reindex api documentation a few times, and can't figure out if it's possible or not. Once the document is copied from the source index to the destination index, is it possible to also remove the source document?

Here is the current _reindex api call body that I'm invoking:

{
  "source": {
    "index": "srcindex",
    "type": "type",
    "query": {
      "range": {
        "date": {
          "from": <timestamp>
        }
      }
    }
  },
  "dest": {
    "index": "dstindex",
    "type": "type"
  }
}
like image 953
kfox Avatar asked May 02 '17 18:05

kfox


1 Answers

Currently, It is not supported i.e copying then deleting immediately(effectively moving a document).

You can find good discussion happened on this topic here.

Eventually, you need to do _reindex then _delete_by_query to achieve your goal.

Hope this helps!

like image 93
avr Avatar answered Oct 03 '22 19:10

avr