Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pmuellr/esc
command-line utility to invoke elasticsearch requests
https://github.com/pmuellr/esc
Last synced: about 1 month ago
JSON representation
command-line utility to invoke elasticsearch requests
- Host: GitHub
- URL: https://github.com/pmuellr/esc
- Owner: pmuellr
- Created: 2019-07-19T03:48:09.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-04T03:44:33.000Z (about 2 years ago)
- Last Synced: 2024-04-09T21:04:44.856Z (9 months ago)
- Language: JavaScript
- Size: 350 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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-jsonThe 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:9220You 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
--------------------------------------------------------------------------------```console
$ 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
}
}
]
}
},
...
}
```