# Mapping Timeout

**URL:** <https://discuss.elastic.co/t/mapping-timeout/217787>\
**Category:** Logstash\
**Created:** [February 4, 2020, 11:29am UTC](https://discuss.elastic.co/t/mapping-timeout/217787 "2020-02-04T11:29:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NewToThis](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@NewToThis](https://discuss.elastic.co/u/NewToThis)\
**Post date:** [February 4, 2020, 11:29am UTC](https://discuss.elastic.co/t/mapping-timeout/217787/1 "2020-02-04T11:29:54Z")

</div>

Hey I am using a very simple aggregation to count entries in an SQL Database.  
If a specific event is being monitored the counter should be lowered by one otherwise it should count up.  
Everything is running under a unique task id.

Code:

```auto
filter {
 aggregate {
    task_id => "%{order}"
    code => "
      map['count'] ||= 0
      map['wip'] ||= 0
            
     
      map['count'] += 1

      if event.get('partnumber') != 0  
        map['wip'] += 1
      end

      if event.get('finaltest_ok') == 1
        map['wip'] -= 1
      end

      event.set('counter', (map['count'].to_f))
      event.set('bad_parts', (map['wip'].to_f))
       
    "
  }
}

```

But what it see in ES/Kibana seems like that the mapping has a timeout and the counter is being reset.

 ![counter_reset](https://us1.discourse-cdn.com/elastic/original/3X/f/5/f5c89f9c74c5c28ea50fd434dfe1f2f67aede2a2.jpeg)

And here is my pipeline config:

```auto
- pipeline.id: database_test
  pipeline.workers: 1
  queue.type: persisted
  queue.checkpoint.acks: 0
  queue.checkpoint.writes: 0
  queue.checkpoint.interval: 0
  path.config: "/logstash-7.3.0/bin/database_test.conf"

```

Any idea why this is happening?

---

<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 4, 2020, 4:58pm UTC](https://discuss.elastic.co/t/mapping-timeout/217787/2 "2020-02-04T16:58:06Z")

</div>

You have a ruby filter that sets a [counter] field, but in kibana you are showing a field called couter. That does not match.

---

<div class="post-metadata">

**Author:** ![NewToThis](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@NewToThis](https://discuss.elastic.co/u/NewToThis)\
**Post date:** [February 4, 2020, 5:04pm UTC](https://discuss.elastic.co/t/mapping-timeout/217787/3 "2020-02-04T17:04:51Z")

</div>

Hi Badger,

yes sorry...that was a typo in the code which I did correct but I forgot to took another screenshot.

But rest assured this is the same field.

---

<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 3, 2020, 5:04pm UTC](https://discuss.elastic.co/t/mapping-timeout/217787/4 "2020-03-03T17:04:54Z")

</div>

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