Giter Site home page Giter Site logo

esdump-py's Introduction

esdump

Dump Elasticsearch documents to jsonl file.

Install

pip install 

Usage

Help

esdump --help

NAME
    esdump - Dump Elasticsearch documents.

SYNOPSIS
    esdump <flags>

DESCRIPTION
    Dump Elasticsearch documents to jsonl (newline-delimited) file.

FLAGS
    -i, --index=INDEX
        Type: str
        Default: ''
        Elasticsearch index.
    -h, --host=HOST
        Type: str
        Default: 'http://localhost:9200'
        Host url.
    -a, --auth=AUTH
        Type: Optional[typing.Optional[str]]
        Default: None
        A json file contains "host", "port", "user" and "secret".
    -q, --query=QUERY
        Type: str
        Default: '{"query":{"match_all":...
        Json string or json file of query.
    -f, --file=FILE
        Type: Optional[typing.Optional[str]]
        Default: None
        Output filename or leave blank to stdout.

CLI

esdump --index "log-*" --host "https://user:[email protected]:9200" --file output.jsonl
esdump --index "log-*" --auth auth.json --file output.jsonl
esdump --index "log-*" --auth auth.json | gzip > output.jsonl.gz
esdump --index "log-*" --auth auth.json --query query.json --file output.jsonl
esdump --index "log-*" --auth auth.json --query '{"query":{"term":{"name":"Jack"}}}' --file output.jsonl

Put classified information in shell history is not recommanded.

Python

import esdump

esdump.cli(
    index="log-*",
    host="https://user:[email protected]:9200",
    query={"query":{"term":{"name":"Jack"}},"_source":["id"]},
    file="output.jsonl",
)

esdump-py's People

Contributors

cgjosephlee avatar

Watchers

 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.