An open API service indexing awesome lists of open source software.

https://github.com/rerost/es-cli

Elasticsearch's operation wrapper tool
https://github.com/rerost/es-cli

cli elasticsearch go golang

Last synced: 11 months ago
JSON representation

Elasticsearch's operation wrapper tool

Awesome Lists containing this project

README

          

# es-cli
[![CircleCI](https://circleci.com/gh/rerost/es-cli/tree/master.svg?style=svg&circle-token=df496b759fd684d97bf6f94c9251763960fcc049)](https://circleci.com/gh/rerost/es-cli/tree/master)

This tool is **still under development**.

It's high useage elasticsearch's operation wrapper tool.
For example, creating index and add/remove alias operations is frequently performed, but JSON API is too complicated(I can not remember).
So I create this tool

## Term
I said `details` is for `mappings`, `settings`, and `aliases`.
Its for creating indecies.
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html

## Installation
`go get -u github.com/rerost/es-cli`

## Usage
### Format
```
$ es-cli args...
$ es-cli [--host=HOST] [--user=BASIC_AUTH_USER] [--pass=BASIC_AUTH_PASSWORD] [--type=ELASTICSEARCH_DOCUMENT_TYPE] args...
```

### Index API
```
$ es-cli list index
$ es-cli create index
$ es-cli create index # Read detail json by stdin
$ es-cli copy index
$ es-cli count index # Return total count of documents
$ es-cli delete index
$ es-cli dump index # Dump details & docs
$ es-cli restore index # Insert docs from dumped doc file(Without details)
$ es-cli restore index # Insert docs from dumped doc file(Without details)
```

### Detail API
```
$ es-cli get detail # Get settings, alias, mappings for creat index
$ es-cli update detail # Zero downtime(without write) update detail
$ es-cli update detail # Read detail json by stdin
```

### Alias API
```
$ es-cli add alias ...
$ es-cli remove alias ...
$ es-cli list alias
```

## Configuration
You can use configuration file.
es-cli see options order by command options > current directory.

configrutaion file name is "`escli.json`
the configuration file's format is json.
e.g
```
{
"user": "user",
"pass": "pass",
"host": "http://localhost:9200",
"type": "_doc"
}
```

when use multiple elasticsearch, use namespace
e.g.
```
{
"production": {
"host": "http://prod-es"
},
"qa": {
"host": "http://qa-es"
}
}
```
and exec `es-cli -n production list index`