taraslayshchuk / es2csv

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

Unable to escape newline characters while exporting to CSV #80

Closed suribabuox closed 3 years ago

suribabuox commented 3 years ago

Hi, Some of the values in the index have newline characters and while exporting those values its writing each record to two lines (if there is one newline character), So the output file looks broken. I am using version 5.5.2

To replicate insert value curl -H "Content-Type: application/json" -X POST "<ip:port>/<index-name>/testtype/1" -d '{"source": "elasticsearch\n6+", "format": "csv"}'

export es2csv -u <ip:port> -i <index-name> -q '*' -o tmp.csv --debug

output file will be

source,format
"elasticsearch
6+",csv

Please let me know if I'm missing something.

Thanks in advance.

suribabuox commented 3 years ago

I just realized it's working as it's supposed to and we'll have to handle that while reading that CSV file.