Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Useful commands for Elasticsearch

Project description


A command-line tool and API for various Elasticsearch operations.

.. image::


pip install elastic-companion

**Note**: The 1.X versions of elastic-companion support Elasticsearch 1.X and
the 5.X versions support Elasticsearch 5.X. This is similar to the versioning
of the official library


To see the list of commands, use the ``-h`` or ``--help`` flag.

Each command has a corresponding Python module that can be imported and used as
an API rather than from the command-line.

### `setup`

The `setup` command will load all indexes, mappings, templates and scripts from the data directory, and send them to ES.

#### `/scripts`

The scripts folder should have `.json` files which act as script descriptors. Each file should have the content:

"id": "SCRIPT_ID",
"lang": "SCRIPT_LANG",
"body": "SCRIPT_BODY",

While `id` and `lang` are required and should match the requirements of ES. These will determine how each script is stored. The values `body` and `path`, however, are mutually exclusive and only one is required. You can specify the script's body directly inline under `body`, or point to a file using `path`.


If you are using Docker and Docker Compose, then you don't need to fiddle with
python and pip manually. Otherwise, see below.

Download Python 3, then::

$ pyvenv-3.X venv
$ source venv/bin/activate
$ pip3 install -r requirements.txt
$ ./ -h

On Ubuntu, there's a bit of an issue with ``pip3`` and the above might not work.

$ pyvenv-3.X venv --without-pip
$ source venv/bin/activate
$ cd venv
$ wget
$ python3
$ cd ..
$ pip3 install -r requirements.txt
$ ./ -h


Use ``nose``::

$ nosetests


$ docker-compose run --rm companion nosetests


You need access to the pypi repository first, then it's just a matter of::

$ python sdist bdist_wheel
$ twine upload dist/*

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
elastic_companion-5.1.0-py3-none-any.whl (16.7 kB) Copy SHA256 hash SHA256 Wheel py3 Feb 28, 2018
elastic-companion-5.1.0.tar.gz (12.8 kB) Copy SHA256 hash SHA256 Source None Feb 28, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page