m_c
m_c

Reputation: 89

Deleting source index after using the clone API possible?

The elastic clone api (https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clone-index.html) states

Cloning works as follows:

  • First, it creates a new target index with the same definition as the source index.
  • Then it hard-links segments from the source index into the target index. (If the file system doesn’t support hard-linking, then all segments are copied into the new index, which is a much more time consuming process.)
  • Finally, it recovers the target index as though it were a closed index which had just been re-opened.

If documents are hard-linked, what happens if I delete the old source index via the delete API?

Upvotes: 1

Views: 164

Answers (1)

Val
Val

Reputation: 217274

A hard link is a mirror copy of the original file, so

  1. Yes
  2. No, because it has been copied
  3. No, if you delete the old index, the original segments are gone, but since they have been copied into your new index, you're fine.

It's easy to test ;-)

Upvotes: 2

Related Questions