Git Product home page Git Product logo

esc's Introduction

command-line utility to invoke elasticsearch requests

usage

command-line utility to invoke elasticsearch requests

usage:

esc [api] [esParams] [esOptions]
    make an http request with the specified API, params and options
esc [api] help
    get help on an api
esc apis
    list the apis

[api] is an elasticsearch api like "index" and "indices.analyze".

[esParams] and [esOptions] are sloppy JSON strings (presumable enclosed in single quotes), as described in https://github.com/pmuellr/sloppy-json

The following options can also be used

-h --help             print this help
-v --version          print the version of the program
-u --urlBase [url]    elasticsearch base URL; default: http://elastic:changeme@localhost:9220

You can also set the env var ES_URLBASE as the elasticsearch base URL.

Set the DEBUG environment variable to any string for additional diagnostics.

For authenticated elasticsearch access, the url should include the userid/password, for example "http://elastic:changeme@localhost:9220"

install

npm install -g pmuellr/esc

examples

$ esc index '{index: foo body: {foo: 1}}'
{
    "body": {
        "_index": "foo",
        "_type": "_doc",
        "_id": "thtOCGwBjWnYRDyrYWYD",
        ...
    },
    "statusCode": 201,
    "headers": {
        "location": "/foo/_doc/thtOCGwBjWnYRDyrYWYD",
        "content-type": "application/json; charset=UTF-8",
        "content-length": "170"
    },
    "warnings": null,
    "meta": {
        ...
    }
}

$ esc search '{index: foo}'
{
    "body": {
        ...
        "hits": {
            "total": {
                "value": 1,
                "relation": "eq"
            },
            "max_score": 1,
            "hits": [
                {
                    "_index": "foo",
                    "_type": "_doc",
                    "_id": "thtOCGwBjWnYRDyrYWYD",
                    "_score": 1,
                    "_source": {
                        "foo": 1
                    }
                }
            ]
        }
    },
    ...
}

esc's People

Contributors

pmuellr avatar

Watchers

 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.