Giter Site home page Giter Site logo

elastic_dumper's Introduction

Dump and Restore Elastic Indices on Disk

Sometimes could be helpful to dump the documents in an Elastic index on disk so that can be "cold" stored and eventually restored later. ElasticDumper allows to dump on disk a set of zipped files containing an index (or a part of it) and if necessary allows to restore it later.

Easy like:

dumper = ElasticDumper(hosts=['localhost:9200', ], index='my_index', doc_type='my_doc_type')

query = {
    'query': {
      'bool': {
          'must': [
                  {'match_all': {}},
              ],
      },
  },
}
dumper.dump(query=query, dump_path='my_index_dump', raw=True)

this will create a folder named my_index_dump which contains:

  • a mapping.json file which contains the specific mapping for the index
  • subfolder data containing one or more data_#.zip files

In order to restore you can just:

dumper.restore(dump_path='my_index_dump', index_name='restored_my_index', doc_type='my_doc_type')

this will take care of creating the index with proper mapping and bulk store the data from the data_#.zip files.

Few customization are available, for those take a look to the code ElasticDumper.

elastic_dumper's People

Contributors

pierluigi-failla avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.