# Aggregate Filter mapping

**URL:** <https://discuss.elastic.co/t/aggregate-filter-mapping/271723>\
**Category:** Logstash\
**Created:** [April 29, 2021, 10:06pm UTC](https://discuss.elastic.co/t/aggregate-filter-mapping/271723 "2021-04-29T22:06:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![StashLogs](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@StashLogs](https://discuss.elastic.co/u/StashLogs)\
**Post date:** [April 29, 2021, 10:06pm UTC](https://discuss.elastic.co/t/aggregate-filter-mapping/271723/1 "2021-04-29T22:06:53Z")

</div>

Hello everyone!  
I am trying to understand this behaviour with the map field syntax in the aggregate filter. In the code below, if I keep the field name as 'syntaxOddity', no data is copied over. But if I change the field name to 'syntaxoddity', it works just fine. This filter is being run after a jdbc input with a sql that has a field aliased to syntaxOddity

```auto
filter {
  aggregate {
        task_id => "%{id}"
        code => "
            map['syntaxOddity'] = event.get('syntaxOddity')
        "
        push_previous_map_as_event => true
        timeout => 60
  }

```

Any thoughts?

---

<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:** [April 29, 2021, 10:29pm UTC](https://discuss.elastic.co/t/aggregate-filter-mapping/271723/2 "2021-04-29T22:29:33Z")

</div>

If you use

```
output { stdout { codec => rubydebug } }

```

what does the field you are trying to add to the map look like?

---

<div class="post-metadata">

**Author:** ![StashLogs](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@StashLogs](https://discuss.elastic.co/u/StashLogs)\
**Post date:** [May 2, 2021, 8:35pm UTC](https://discuss.elastic.co/t/aggregate-filter-mapping/271723/3 "2021-05-02T20:35:50Z")

</div>

I see out with field name like 'syntaxoddity'. Not sure whats going on here. I have an index template that defines the field as 'syntaxOddity'. Weird enough, logstash seems to be adding one more field to the index mapping in all lower case. I must be missing something basic here.  
The jdbc filter has a query that has aliased all fields in camel case.

```auto
select emp.syntax_oddity syntaxOddity from ....

```

Those field names are used in the agg filter as well as in the index template. I verified that the template is created properly and is applied to the index.

```auto
"syntaxOddity " : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },

```

Still logstash adds more fields in lower case.

---

<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:** [May 30, 2021, 8:35pm UTC](https://discuss.elastic.co/t/aggregate-filter-mapping/271723/4 "2021-05-30T20:35:58Z")

</div>

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