[okfn-labs] ElasticSearch backup/restore

Mark MacGillivray mark.macgillivray at okfn.org
Mon Apr 16 13:40:59 UTC 2012

(and resending again - sent from wrong address, got bounced)

Hi Nick,

I thought it was possible to just copy the data files directly out of the
ES data folder, then go to your alternate, create the database and POST the
mappings, then dump the data files you copied in place of the empty ones
that were just created on your alternate. (It has been a while since I did
this and maybe does not work any more or is harder, but I am certain I have
done it in the past).

On Mon, Apr 16, 2012 at 2:29 PM, Nick Stenning <nick at whiteink.com> wrote:

> Dear all,
> As part of work on AnnotateIt, I've had a need to copy data from
> ElasticSearch between different indices (for example, copying data
> from the production to the staging index, in order to do proper
> acceptance testing on what was once live data).
> It's actually a little tricky to do this in a nice way (or so I
> found), but I've now got a workable solution which I thought might be
> useful for some of you. It's committed to the sysadmin repo:
>  https://bitbucket.org/okfn/sysadmin/changeset/0ed32c94c47f
> And you use it thusly:
>  backup-es.sh localhost:9200 index_name
> Which will generate a mappings file, and a line-delimited file with
> all your documents in. You can then:
>  restore-es.sh localhost:9200 another_index_name mappings.json
> documents.json
> It's not fast or clever, but I hope some of you find this useful
> nonetheless.
> Best,
> Nick
> _______________________________________________
> okfn-labs mailing list
> okfn-labs at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/okfn-labs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/okfn-labs/attachments/20120416/c20a105e/attachment-0002.html>

More information about the okfn-labs mailing list