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

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