# Elasticsearch Highlight result export to CSV

**URL:** <https://discuss.elastic.co/t/elasticsearch-highlight-result-export-to-csv/119170>\
**Category:** Elasticsearch\
**Created:** [February 9, 2018, 6:09am UTC](https://discuss.elastic.co/t/elasticsearch-highlight-result-export-to-csv/119170 "2018-02-09T06:09:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ESAS](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@ESAS](https://discuss.elastic.co/u/ESAS)\
**Post date:** [February 9, 2018, 6:09am UTC](https://discuss.elastic.co/t/elasticsearch-highlight-result-export-to-csv/119170/1 "2018-02-09T06:09:37Z")

</div>

Hi ,

I am trying to export the resultset of a highlighted query to CSV. I use the logstash-csv-output to do this.  
But while exporting to CSV I only get the below and not the resultset from highlight query

{  
"course\_publish\_date" =\> "2015-01-19",  
"name" =\> "Accounting 101",  
"students\_enrolled" =\> 27,  
"course\_description" =\> "Act 101 is a course from the business school on the introduction to accounting that teaches students how to read and compose basic financial statements",  
"room" =\> "E3",  
"@version" =\> "1",  
"true" =\> {  
"\_type" =\> "classroom",  
"\_index" =\> "courses",  
"\_id" =\> "1"  
},  
"professor" =\> {  
"department" =\> "finance",  
"facutly\_type" =\> "part-time",  
"name" =\> "Thomas Baszo",  
"email" =\> "baszot@onuni.com"  
},  
"@timestamp" =\> 2018-02-09T05:21:08.747Z  
}

BELOW is my config file

input {

# Read all documents from Elasticsearch matching the given query

elasticsearch {

hosts =\> "localhost"  
index =\> "courses"  
docinfo =\> true  
docinfo\_target =\> true  
query =\> '  
{"query" : {  
"match": { "course\_description": "financial" }  
},  
"highlight" : {  
"number\_of\_fragments" : 3,  
"fragment\_size" : 150,  
"fields" : {  
"\_all" : { "pre\_tags" : ["_"], "post\_tags" : ["_"] },  
"course\_description" : { "number\_of\_fragments" : 5, "order" : "score" }  
}  
}

}'  
codec=\> json  
}

}  
output {

csv {

fields =\> ["true","room","name","professor.name","highlight"]  
path =\> "/csv-export1.csv"

}  
stdout { codec =\> rubydebug }  
}  
I get the highlighted tags when executing the same on Kibana.

Looking forward to a solution

Thankyou in advance.

---

<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:** [March 9, 2018, 6:09am UTC](https://discuss.elastic.co/t/elasticsearch-highlight-result-export-to-csv/119170/2 "2018-03-09T06:09:45Z")

</div>

Closed on March 9, 2018, 6:09am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
