Elasticsearch Highlight result export to CSV


(Anj) #1

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.


(system) #2

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