# Polling New/Modified elasticsearch records to another endpoint

**URL:** <https://discuss.elastic.co/t/polling-new-modified-elasticsearch-records-to-another-endpoint/217530>\
**Category:** Logstash\
**Created:** [February 2, 2020, 1:58pm UTC](https://discuss.elastic.co/t/polling-new-modified-elasticsearch-records-to-another-endpoint/217530 "2020-02-02T13:58:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zee](https://avatars.discourse-cdn.com/v4/letter/z/df788c/32.png) [@Zee](https://discuss.elastic.co/u/Zee)\
**Post date:** [February 2, 2020, 1:58pm UTC](https://discuss.elastic.co/t/polling-new-modified-elasticsearch-records-to-another-endpoint/217530/1 "2020-02-02T13:58:42Z")

</div>

Hi,

I am trying to find a solution to read all elasticsearch records periodically every 1 minute, that have been modified or newly created in an elasticsearch index. These new records further need to be published using logstash into a Kafka or queue endpoint.

I see there is exactly an option in jdbc input plugin where you can poll database using specify  
"tracking\_column" , "tracking\_column\_type" , "use\_column\_value " which gives you changed/new records in result set.

I explored Elasticsearch input plugin but it does not seem to have similar options, is there a way to do this using logstash elasticsearch input plugin or another logstash input plugin. Would appreciate any pointers.

Thanks

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 3, 2020, 12:32am UTC](https://discuss.elastic.co/t/polling-new-modified-elasticsearch-records-to-another-endpoint/217530/2 "2020-02-03T00:32:47Z")

</div>

There is no support for persisting a value from the most recent document fetched by an elasticsearch input. There is an open [issue](https://github.com/logstash-plugins/logstash-input-elasticsearch/issues/93) where that was requested a couple of years ago but I see no indication that anyone has acted on it.

If I absolutely had to do this in logstash I would use two ruby filters, the first to fetch the value of a tracking value from an instance variable, and the second to store said tracking value. In between the two I would use an http filter to make a call to elasticsearch. Then parse the response and use a split filter to generate multiple documents. You could drive the whole thing with

```
 input { exec { command => "/bin/true" interval => 60 } }

```

You would have to set pipeline.workers to 1, so it does not scale, and for now you would need to disable the java execution engine (a [fix](https://github.com/elastic/logstash/issues/10938) for that has been implemented, but not released).

It would probably be easier to implement in /bin/sh than logstash 🙂

---

<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 2, 2020, 12:32am UTC](https://discuss.elastic.co/t/polling-new-modified-elasticsearch-records-to-another-endpoint/217530/3 "2020-03-02T00:32:50Z")

</div>

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