Git Product home page Git Product logo

elasticsearch-query-to-json's Introduction

please use elasticdump instead of this package. It's much more powerful and maintained.

elasticsearch-query-to-json

cli tool to fetch all documents from elasticsearch by query.

usage

$ elasticsearch-query-to-json -h "$ELASTIC_HOST" -i "$ELASTIC_INDEX" -b "$QUERY" -o output.json -f jsonPerRow

available options

  • --host(-h) host eg. http://elasticsearch.co:9200
  • --index(-i) index
  • --body(-b) query body - some examples below
  • --output(-o) output file - leave empty to write results to stdout
  • --format(-f) - possible values:['json','jsonPerRow'] - json means single array with elements, jsonPerRow means every record is encoded as json as put into separate line
  • --scroll specify how long a consistent view of the index should be maintained for scrolled search - default 1m
  • --size - number of hits to return at once - default 1000
  • --contentOnly - write only _source_ field value

some examples of --body

  • get all documents from yesterday based on timestamp field
'{"query":{"range":{"timestamp":{"gte":"now-1d/d","lt": "now/d"}}}}'
  • get all documents with ip field equals "127.0.0.1"
{"query":{"bool":{"must":[{"match_phrase":{"ip":{"query":"127.0.0.1"}}}]}}}

elasticsearch-query-to-json's People

Contributors

psrebniak 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.