# Not able to get expected output from elasticsearch through logstash pipeline

**URL:** https://discuss.elastic.co/t/not-able-to-get-expected-output-from-elasticsearch-through-logstash-pipeline/111696
**Category:** Logstash
**Created:** [December 14, 2017, 7:18am UTC](https://discuss.elastic.co/t/not-able-to-get-expected-output-from-elasticsearch-through-logstash-pipeline/111696 "2017-12-14T07:18:02Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![somkhil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/somkhil/32/108980_2.png) [@somkhil](https://discuss.elastic.co/u/somkhil)
#### Post date: [December 14, 2017, 7:18am UTC](https://discuss.elastic.co/t/not-able-to-get-expected-output-from-elasticsearch-through-logstash-pipeline/111696/1 "2017-12-14T07:18:02Z")

</div>

HI  
I am running logstash pipeline to pull the data from elasticsearch and output it into csv file.  
At the very first run it generated output properly. However during subsequent runs (after loading more data/fields into elasticsearch) it is not giving proper output.

Two questions :

1. Is there any setting to clear out earlier offsets/history so that logstash can consider every request as fresh one and pull all the data from elasticsearch based on the specified query.

2. How do I specify document type in the input section of logstash config file. Index name can be specified with "index" attribute. Is there any attribute for specifying document type within index.

input {  
elasticsearch {  
hosts =\> ["localhost:9200"]  
index =\> "xyz"

Thanks.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [December 14, 2017, 7:32am UTC](https://discuss.elastic.co/t/not-able-to-get-expected-output-from-elasticsearch-through-logstash-pipeline/111696/2 "2017-12-14T07:32:19Z")

</div>

> Is there any setting to clear out earlier offsets/history so that logstash can consider every request as fresh one and pull all the data from elasticsearch based on the specified query.

The elasticsearch input doesn't store any state so it pulls all data each time.

> How do I specify document type in the input section of logstash config file. Index name can be specified with "index" attribute. Is there any attribute for specifying document type within index.

Use the `query` option?

---

<div class="post-metadata">

### Author: ![somkhil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/somkhil/32/108980_2.png) [@somkhil](https://discuss.elastic.co/u/somkhil)
#### Post date: [December 14, 2017, 8:53am UTC](https://discuss.elastic.co/t/not-able-to-get-expected-output-from-elasticsearch-through-logstash-pipeline/111696/3 "2017-12-14T08:53:31Z")

</div>

> The elasticsearch input doesn't store any state so it pulls all data each time.

Actually I am seeing different behavior. When I ran logstash pipeline initially with 10 fields in the elasticsearch doc. I got all the docs with those 10 fields populated properly in the output csv.

After adding around 30 new fields in the same elasticsearch documents, I am getting most of the earlier fields as empty. Does logstash tries to get the delta somehow.

> Use the `query` option?  
> Thanks. I got this working by adding filter on "\_type" field.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [December 14, 2017, 9:47am UTC](https://discuss.elastic.co/t/not-able-to-get-expected-output-from-elasticsearch-through-logstash-pipeline/111696/4 "2017-12-14T09:47:56Z")

</div>

> Does logstash tries to get the delta somehow.

No, it doesn't.

---

<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: [January 11, 2018, 9:48am UTC](https://discuss.elastic.co/t/not-able-to-get-expected-output-from-elasticsearch-through-logstash-pipeline/111696/5 "2018-01-11T09:48:10Z")

</div>

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