taraslayshchuk / es2csv

Export from an Elasticsearch into a CSV file
Apache License 2.0
511 stars 190 forks source link

Is there a way to force the columns order in output? #21

Closed karthikdivi closed 7 years ago

karthikdivi commented 7 years ago

es2csv is not honouring the order of specified columns. For example if it write -f b a in the output csv i see a column first.

taraslayshchuk commented 7 years ago

This question was already asked. So let me explain why it is sorted. When you are using -f you will ask elasticsearch for specific fields, but they can be missing in ES. Thats way es2csv don't care about order of asked fields (ES already returns fields in wrong order). So best solution for me was just sort them in alphabetic. Any way you can move columns in your favorite editor (MS Office, LibreOffice).

taraslayshchuk commented 7 years ago

Hello, @karthikdivi, please check 2.4.2 release, this should fix columns order.

karthikdivi commented 7 years ago

Awesome @taraslayshchuk Thanks again for the great tool.