taraslayshchuk / es2csv

Export from an Elasticsearch into a CSV file
Apache License 2.0
510 stars 191 forks source link

how to read the query string from file? #5

Closed bigbangtomato closed 8 years ago

bigbangtomato commented 8 years ago

sometimes i need to use terms query which include 10-thousands of uid. It take a long time to paste the whole command in console window.

thanks~

bigbangtomato commented 8 years ago

and then i get this result. T-T

bash: /usr/local/bin/es2csv: Argument list too long

taraslayshchuk commented 8 years ago

Yes, there is ARG_MAX limitation for different OS. I added option to read query from file, example:

$ es2csv -q @'query string.json' -o out.csv -r -i index*
Found 1 results
Run query [###################] [1/1] [100%] [0:00:00] [Time: 0:00:00] [239.80  docs/s]
Write to csv [###############] [1/1] [100%] [0:00:00] [Time: 0:00:00] [  2.33 klines/s]

This changes are in query_string_from_file branch.

$ pip uninstall es2csv
$ pip install git+https://github.com/taraslayshchuk/es2csv.git@query_string_from_file

Could you please test it?

bigbangtomato commented 8 years ago

Thank you so much, i'll test it this week. 😘

taraslayshchuk commented 8 years ago

Hey, @iamtiancaif! How's it going?

bigbangtomato commented 8 years ago

Hi, @taraslayshchuk ! It worked pretty well. I just forgot to tell you about it. Thanks for your wonderful work!!

picture1