Deleting source index after using the clone API possible?

60 Views Asked by At

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?

  • Are the hard-linked segments copied to the new index data directory?
  • Is the data lost?
  • Are the hard-linked segments just kept in their original location on disk?
1

There are 1 best solutions below

1
On BEST ANSWER

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 ;-)