How to send data to elasticsearch using logstash?

HI ,
I want to send a txt.file which contains some documents into elasticsearch using logstash .
So, how can i configure my .config file in such a way that it sends the data to elasticsearch..

Thanks

Use the file input and the ES output.
It'll also depend on if you want to do any transformation too though/

Hi,
I tried the following .conf code

input {
file {
path => "C:\Users\Desktop\mediacontent-jan-2017\0-1000.txt"
start_position => "beginning"
}
}
output {
elasticsearch {
hosts => "http://localhost:9200"
index => "receive"
}
}

I already created a index name "receive" in my cluster and i want to send the data in 0-1000.txt to "receive" index .

when i used the code in the cmd prompt it is showing error like

Error: [400] {"error":{"root_cause":[{"type":"parse_exception","reason":"Failed to deri
ve xcontent"}],"type":"search_phase_execution_exception","reason":"all shards failed","ph
ase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"mediacontent-jan-2017","
node":"BKnWYe4zSxubdFOUgGEGWg","reason":{"type":"parse_exception","reason":"Failed to der
ive xcontent"}}]},"status":400}

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