kfox
kfox

Reputation: 1186

Elasticsearch reindex api deleting document after copy

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"
  }
}

Upvotes: 5

Views: 4488

Answers (1)

avr
avr

Reputation: 4883

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!

Upvotes: 4

Related Questions