# How to export overall fields in CSV format using CSV output plugin in LS

**URL:** <https://discuss.elastic.co/t/how-to-export-overall-fields-in-csv-format-using-csv-output-plugin-in-ls/37110>\
**Category:** Logstash\
**Created:** [December 14, 2015, 9:55am UTC](https://discuss.elastic.co/t/how-to-export-overall-fields-in-csv-format-using-csv-output-plugin-in-ls/37110 "2015-12-14T09:55:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikas\_gopal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikas_gopal/32/47661_2.png) [@vikas\_gopal](https://discuss.elastic.co/u/vikas_gopal)\
**Post date:** [December 14, 2015, 9:55am UTC](https://discuss.elastic.co/t/how-to-export-overall-fields-in-csv-format-using-csv-output-plugin-in-ls/37110/1 "2015-12-14T09:55:22Z")

</div>

Hi Experts ,

I want to export ES documents in CSV format using CSV output plugin in LS, this is what I have done.

> ```
> input {
> elasticsearch {
> hosts => "localhost"
> query => '{"query": { "bool": { "must": [{ "match_all": { } }],"must_not": [],"should": []}}}'
> }
> }
> output {
> # We write to the CSV file
> csv {
> fields => ["dvc", "shost"]
> path => "e:/test.csv"
> }
> }
> 
> ```

Requirement

1. What I want is to export all the fields as I have 200 fields ,so it is hard to mention all the field names in the array . Please let me know how I can achieve this ?
2. After export I cannot see field name in the first row , LS just export values except field name , please suggest how I can get the fields name in the first row ?

Thanks  
VG

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 5:18am UTC](https://discuss.elastic.co/t/how-to-export-overall-fields-in-csv-format-using-csv-output-plugin-in-ls/37110/2 "2017-07-06T05:18:37Z")

</div>


