# How to send data to elasticsearch using logstash?

**URL:** https://discuss.elastic.co/t/how-to-send-data-to-elasticsearch-using-logstash/71193
**Category:** Logstash
**Created:** [January 11, 2017, 8:59am UTC](https://discuss.elastic.co/t/how-to-send-data-to-elasticsearch-using-logstash/71193 "2017-01-11T08:59:31Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Yaswanth](https://avatars.discourse-cdn.com/v4/letter/y/94ad74/32.png) [@Yaswanth](https://discuss.elastic.co/u/Yaswanth)
#### Post date: [January 11, 2017, 8:59am UTC](https://discuss.elastic.co/t/how-to-send-data-to-elasticsearch-using-logstash/71193/1 "2017-01-11T08:59:32Z")

</div>

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

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [January 11, 2017, 9:27am UTC](https://discuss.elastic.co/t/how-to-send-data-to-elasticsearch-using-logstash/71193/2 "2017-01-11T09:27:16Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Yaswanth](https://avatars.discourse-cdn.com/v4/letter/y/94ad74/32.png) [@Yaswanth](https://discuss.elastic.co/u/Yaswanth)
#### Post date: [January 11, 2017, 9:34am UTC](https://discuss.elastic.co/t/how-to-send-data-to-elasticsearch-using-logstash/71193/3 "2017-01-11T09:34:27Z")

</div>

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](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}

---

<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: [February 8, 2017, 9:34am UTC](https://discuss.elastic.co/t/how-to-send-data-to-elasticsearch-using-logstash/71193/4 "2017-02-08T09:34:58Z")

</div>

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