Git Product home page Git Product logo

elastictl's Introduction

elastictl

Simple tool to import/export Elasticsearch indices into a file, and/or reshard an index. The tool can be used for:

  • Backup/restore of an Elasticsearch index
  • Performance test an Elasticsearch cluster (import with high concurrency, see --workers)
  • Change the shard/replica count of an index (see reshard subcomment)

In my local cluster, I was able to import ~10k documents per second.

Build

$ go build

Or via goreleaser:

$ make [build | build-snapshot]

Installation

For Debian/Ubuntu

wget https://github.com/binwiederhier/elastictl/releases/download/v0.0.5/elastictl_0.0.5_amd64.deb
dpkg -i *.deb

All others:

wget https://github.com/binwiederhier/elastictl/releases/download/v0.0.5/elastictl_0.0.5_linux_x86_64.tar.gz
tar zxvf elastictl_0.0.5_linux_x86_64.tar.gz
./elastictl

Usage:

Export/dump an index to a file

The first line of the output format is the mapping, the rest are the documents.

# Entire index
elastictl export dummy > dummy.json

# Only a subset of documents
elastictl export \
  --search '{"query":{"bool":{"must_not":{"match":{"eventType":"Success"}}}}}' \
  dummy > dummy.json

Import to new index

# With high concurrency
cat dummy.json | elastictl import --workers 100 dummy-copy

Reshard (import/export) an index

This commands export the index dummy to dummy.json and re-imports it as dummy using a different number of shards. This command does DELETE the index after exporting it!

elastictl reshard \
  --search '{"query":{"bool":{"must_not":{"match":{"eventType":"Success"}}}}}' \
  --shards 1 \
  --replicas 1 \
  dummy

elastictl's People

Contributors

binwiederhier avatar subbyte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

elastictl's Issues

SSL Support

Currently http is hard-coded as the protocol talking to Elasticsearch. It will be great if we have SSL/HTTPS support.

Content Type is mandatory with ES > 6

Hi,

I was testing your tool and it has some problems. Because you get a lot of 406 status codes. This is because ES requires 'Content-Type: application/json'.

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.