Closed anandgavai closed 6 years ago
I am not sure what locale.Error: unsupported locale setting
error means, but es2csv perfectly installable on ubuntu 16.04 and python 2.7.12, pip 8.1.1 for me:
root@31797658fb91:/# cat /etc/issue
Ubuntu 16.04.4 LTS \n \l
root@31797658fb91:/# python --version
Python 2.7.12
root@31797658fb91:/# pip --version
pip 8.1.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
root@31797658fb91:/# pip install es2csv
Collecting es2csv
Downloading es2csv-5.2.1-py27-none-any.whl
Collecting progressbar2<3.11.0,>=3.10.0 (from es2csv)
Downloading progressbar2-3.10.1-py2.py3-none-any.whl
Collecting elasticsearch<5.3.0,>=5.2.0 (from es2csv)
Downloading elasticsearch-5.2.0-py2.py3-none-any.whl (57kB)
100% |################################| 61kB 1.2MB/s
Collecting python-utils>=2.0.0 (from progressbar2<3.11.0,>=3.10.0->es2csv)
Downloading python_utils-2.3.0-py2.py3-none-any.whl
Collecting urllib3<2.0,>=1.8 (from elasticsearch<5.3.0,>=5.2.0->es2csv)
Downloading urllib3-1.22-py2.py3-none-any.whl (132kB)
100% |################################| 133kB 1.6MB/s
Collecting six (from python-utils>=2.0.0->progressbar2<3.11.0,>=3.10.0->es2csv)
Downloading six-1.11.0-py2.py3-none-any.whl
Installing collected packages: six, python-utils, progressbar2, urllib3, elasticsearch, es2csv
Successfully installed elasticsearch-5.2.0 es2csv-5.2.1 progressbar2-3.10.1 python-utils-2.3.0 six-1.11.0 urllib3-1.22
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
root@31797658fb91:/# es2csv --help
usage: es2csv [-h] -q QUERY [-u URL] [-a AUTH] [-i INDEX [INDEX ...]]
[-D DOC_TYPE [DOC_TYPE ...]] [-t TAGS [TAGS ...]] -o FILE
[-f FIELDS [FIELDS ...]] [-d DELIMITER] [-m INTEGER]
[-s INTEGER] [-k] [-r] [-e] [--verify-certs]
[--ca-certs CA_CERTS] [--client-cert CLIENT_CERT]
[--client-key CLIENT_KEY] [-v] [--debug]
title: A CLI tool for exporting data from Elasticsearch into a CSV file.
description: Command line utility, written in Python, for querying Elasticsearch in Lucene query syntax or Query DSL syntax and exporting result as documents into a CSV file.
usage: es2csv -q '*' -i _all -e -o ~/file.csv -k -m 100
es2csv -q '{"query": {"match_all": {}}}' -r -i _all -o ~/file.csv
es2csv -q @'~/long_query_file.json' -r -i _all -o ~/file.csv
es2csv -q '*' -i logstash-2015-01-* -f host status message -o ~/file.csv
es2csv -q 'host: localhost' -i logstash-2015-01-01 logstash-2015-01-02 -f host status message -o ~/file.csv
es2csv -q 'host: localhost AND status: GET' -u http://kibana.com:80/es/ -o ~/file.csv
es2csv -q '*' -t dev prod -u http://login:password@kibana.com:6666/es/ -o ~/file.csv
es2csv -q '{"query": {"match_all": {}}, "filter":{"term": {"tags": "dev"}}}' -r -u http://login:password@kibana.com:6666/es/ -o ~/file.csv
optional arguments:
-h, --help show this help message and exit
-q QUERY, --query QUERY
Query string in Lucene syntax.
-u URL, --url URL Elasticsearch host URL. Default is
http://localhost:9200.
-a AUTH, --auth AUTH Elasticsearch basic authentication in the form of
username:password.
-i INDEX [INDEX ...], --index-prefixes INDEX [INDEX ...]
Index name prefix(es). Default is ['logstash-*'].
-D DOC_TYPE [DOC_TYPE ...], --doc_types DOC_TYPE [DOC_TYPE ...]
Document type(s).
-t TAGS [TAGS ...], --tags TAGS [TAGS ...]
Query tags.
-o FILE, --output_file FILE
CSV file location.
-f FIELDS [FIELDS ...], --fields FIELDS [FIELDS ...]
List of selected fields in output. Default is
['_all'].
-d DELIMITER, --delimiter DELIMITER
Delimiter to use in CSV file. Default is ",".
-m INTEGER, --max INTEGER
Maximum number of results to return. Default is 0.
-s INTEGER, --scroll_size INTEGER
Scroll size for each batch of results. Default is 100.
-k, --kibana_nested Format nested fields in Kibana style.
-r, --raw_query Switch query format in the Query DSL.
-e, --meta_fields Add meta-fields in output.
--verify-certs Verify SSL certificates. Default is False.
--ca-certs CA_CERTS Location of CA bundle.
--client-cert CLIENT_CERT
Location of Client Auth cert.
--client-key CLIENT_KEY
Location of Client Cert Key.
-v, --version Show version and exit.
--debug Debug mode on.
Getting the following error on ubuntu 16.04 and python 2.7.12, pip 8.1.1