# How to get only deltas in elasticsearch input

**URL:** <https://discuss.elastic.co/t/how-to-get-only-deltas-in-elasticsearch-input/283708>\
**Category:** Logstash\
**Created:** [September 8, 2021, 8:02pm UTC](https://discuss.elastic.co/t/how-to-get-only-deltas-in-elasticsearch-input/283708 "2021-09-08T20:02:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![francieliton\_araujo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/francieliton_araujo/32/47771_2.png) [@francieliton\_araujo](https://discuss.elastic.co/u/francieliton_araujo)\
**Post date:** [September 8, 2021, 8:02pm UTC](https://discuss.elastic.co/t/how-to-get-only-deltas-in-elasticsearch-input/283708/1 "2021-09-08T20:02:24Z")

</div>

I would like to know how I do something like jdbc-input, that the query is always the most recent, but this using elaticsearch\_input.  
if it is not possible, please help me to build a query that returns everything from the last 6 months for example, follow my input

```auto
input {
      elasticsearch {
        hosts => "localhost"
        index => "XXXXXXX*"
        query => '{ "query": { "query_string": { "query": "*" } } }'
        size => 500
        scroll => "5m"
     
      }
}

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 8, 2021, 8:41pm UTC](https://discuss.elastic.co/t/how-to-get-only-deltas-in-elasticsearch-input/283708/2 "2021-09-08T20:41:07Z")

</div>

You should use [a range query](https://www.elastic.co/guide/en/elasticsearch//reference/7.14/query-dsl-range-query.html#ranges-on-dates) for this.

---

<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:** [October 6, 2021, 8:41pm UTC](https://discuss.elastic.co/t/how-to-get-only-deltas-in-elasticsearch-input/283708/3 "2021-10-06T20:41:10Z")

</div>

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