# Increment similar event count if occurs inside time window

**URL:** <https://discuss.elastic.co/t/increment-similar-event-count-if-occurs-inside-time-window/112669>\
**Category:** Elasticsearch\
**Created:** [December 20, 2017, 3:43pm UTC](https://discuss.elastic.co/t/increment-similar-event-count-if-occurs-inside-time-window/112669 "2017-12-20T15:43:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cj\_elastic](https://avatars.discourse-cdn.com/v4/letter/c/51bf81/32.png) [@cj\_elastic](https://discuss.elastic.co/u/cj_elastic)\
**Post date:** [December 20, 2017, 3:43pm UTC](https://discuss.elastic.co/t/increment-similar-event-count-if-occurs-inside-time-window/112669/1 "2017-12-20T15:43:15Z")

</div>

I have several events that are processed by logstash and gets inserted to elastic db. For certain events instead of creating a record I need to increment a counter field in my record if it matches a given type and creation\_time is in certain range.

Is there a way to do this using logstash plugin or in elastic query without the network overhead of multiple requests.

Im looking for a way to perform upsert in 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:** [January 17, 2018, 3:43pm UTC](https://discuss.elastic.co/t/increment-similar-event-count-if-occurs-inside-time-window/112669/2 "2018-01-17T15:43:35Z")

</div>

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