Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Found 0 results #29

Closed
fourteenminusone opened this issue May 29, 2017 · 15 comments
Closed

Found 0 results #29

fourteenminusone opened this issue May 29, 2017 · 15 comments

Comments

@fourteenminusone
Copy link

I'm trying to use the command line utility es2csv to export data from Elasticsearch into CSV file with the following syntax taken from github repo:

es2csv -i logstash-2015-07-07 -q 'host: localhost' -o database.csv

So in my case I run the following command:

es2csv -i enron_test -q 'http://localhost:9200' -o database.csv

The problem is that this command returns Found 0 results, but I have some documents indexed into Elasticsearch database.

Anyone can solve this problem? Am I wrong in the syntax of the command? Thank you guys

@taraslayshchuk
Copy link
Owner

Try: es2csv -i enron_test -q '*' -o database.csv

@fourteenminusone
Copy link
Author

fourteenminusone commented May 30, 2017 via email

@taraslayshchuk
Copy link
Owner

Please use python 2.7.

@fourteenminusone
Copy link
Author

fourteenminusone commented May 30, 2017

I'm using python 2.7

python
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.

@taraslayshchuk
Copy link
Owner

taraslayshchuk commented May 30, 2017

File "/usr/local/lib/python3.5/dist-packages/es2csv.py", line 237, in
Looks like pip is not.

@fourteenminusone
Copy link
Author

fourteenminusone commented May 30, 2017 via email

@fourteenminusone
Copy link
Author

How to uninstall and install again this utility?

@taraslayshchuk
Copy link
Owner

How can I use python 2.7 with es2csv?

Use pip which using python 2.7 for installation es2csv.

How to uninstall and install again this utility?

pip uninstall es2csv
pip install es2csv

@matthewbyrne
Copy link

I'm having the same problem, but im using python 2.7:

Run query [                                                              ] [0/1398742] [  0%] [0:00:00] [ETA:  --:--:--] [  0.0 s/docs]Traceback (most recent call last):
  File "/usr/local/bin/es2csv", line 11, in <module>
    load_entry_point('es2csv==5.2.1', 'console_scripts', 'es2csv')()
  File "/Library/Python/2.7/site-packages/es2csv.py", line 283, in main
    es.search_query()
  File "/Library/Python/2.7/site-packages/es2csv.py", line 40, in f_retry
    return f(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/es2csv.py", line 177, in search_query
    res = next_scroll(res['_scroll_id'])
  File "/Library/Python/2.7/site-packages/es2csv.py", line 40, in f_retry
    return f(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/es2csv.py", line 93, in next_scroll
    return self.es_conn.scroll(scroll=self.scroll_time, scroll_id=scroll_id)
  File "/Library/Python/2.7/site-packages/elasticsearch/client/utils.py", line 73, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/Library/Python/2.7/site-packages/elasticsearch/client/__init__.py", line 955, in scroll
    params=params, body=body)
  File "/Library/Python/2.7/site-packages/elasticsearch/transport.py", line 318, in perform_request
    status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
  File "/Library/Python/2.7/site-packages/elasticsearch/connection/http_urllib3.py", line 128, in perform_request
    self._raise_error(response.status, raw_data)
  File "/Library/Python/2.7/site-packages/elasticsearch/connection/base.py", line 122, in _raise_error
    raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError```

@taraslayshchuk
Copy link
Owner

@matthewbyrne Your request hit 1398742 results.
@RicoSpm did you fix your problem?

@matthewbyrne
Copy link

@taraslayshchuk Yup. Proud of that. Is there a limit?

@taraslayshchuk
Copy link
Owner

@matthewbyrne No, please provide more information: OS, python version, es2csv version, elasticsearch version and run arguments. And it will be better to open a separate issue.

@matthewbyrne
Copy link

Im running this dockerised ELK stack:
https://hub.docker.com/r/sebp/elk/
Using this tag version:
ELK: E1L1K4: Elasticsearch 1.7.3, Logstash 1.5.5, and Kibana 4.1.2.
OS: Running Enterprise Linux 7
Python version: Python 2.7.6
es2csv version: es2csv 5.2.1
Command:
es2csv -f field1 field2 field3 -i logstash-2017.06.19 -q 'type: nginx' -o database.csv>

@taraslayshchuk
Copy link
Owner

My apologies, but es2csv currently supports only Elasticsearch 2.x and 5.x.
You can try to use es2csv-2.4.4 or downgrade to oldest one.

@matthewbyrne
Copy link

That looks to have got me over that hurdle.
pip install -I es2csv==2.4.4 to install the older version, and the query is running at the moment. Pulling down 5.4million records. Fun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants