# JDBC SQL and Inner and aggregate plug in

**URL:** <https://discuss.elastic.co/t/jdbc-sql-and-inner-and-aggregate-plug-in/157930>\
**Category:** Logstash\
**Created:** [November 22, 2018, 7:26pm UTC](https://discuss.elastic.co/t/jdbc-sql-and-inner-and-aggregate-plug-in/157930 "2018-11-22T19:26:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave2](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@Dave2](https://discuss.elastic.co/u/Dave2)\
**Post date:** [November 22, 2018, 7:26pm UTC](https://discuss.elastic.co/t/jdbc-sql-and-inner-and-aggregate-plug-in/157930/1 "2018-11-22T19:26:13Z")

</div>

Hi, first of all congratulations on your site and documentation

I have a problem with my configuration, everything works fine, but there is something I can't accomplish

I have this SQL results

|clipid|ClientCode|Title|

where

clipid is an int value, unique  
clientcode is a value where can be many  
text is the text of the clipid

I need something like this

clipid = 345  
clientcodes {  
clientcode = 2  
clientcode = 3  
cliencode = 4  
}  
text = "blablabla"

for some reason only I can save 2 clientcodes, and no more

this is my config

```
   filter {
 aggregate {
   task_id => "%{clipid}"
   code => "
     map['clipid'] = event.get('clipid')
     map['clientcodes'] ||= []
     map['clientcodes'] << {'clientcode' => event.get('clientcode')}
     event.cancel()
   "
   push_previous_map_as_event => true
   timeout => 10
 }

```

}

output {

elasticsearch {  
hosts =\> ["[http://192.168.2.24:9200](http://192.168.2.24:9200)"]  
index =\> "clipsx"  
document\_type =\> "jdbccon"  
document\_id =\> "%{clipid}"  
doc\_as\_upsert =\> true  
action =\> "update"  
}

stdout { codec =\> rubydebug }  
}

and this is what Kibana show me , notice I do not have the single text

{  
"\_index": "clipsx",  
"\_type": "jdbccon",  
"\_id": "45143427",  
"\_version": 2,  
"\_score": null,  
"\_source": {  
"@version": "1",  
"clipid": 45143427,  
"@timestamp": "2018-11-22T18:10:57.811Z",  
"clientcodes": [  
{  
"clientcode": 64  
},  
{  
"clientcode": 50181 #this is a number that needs to be updated  
}  
],  
"tags": [  
"\_aggregatefinalflush"  
]  
},  
"fields": {  
"@timestamp": [  
"2018-11-22T18:10:57.811Z"  
]  
},  
"sort": [  
1542910257811  
]  
}

Can you help me please?

---

<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:** [December 20, 2018, 7:26pm UTC](https://discuss.elastic.co/t/jdbc-sql-and-inner-and-aggregate-plug-in/157930/2 "2018-12-20T19:26:15Z")

</div>

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