# Is it possible to aggregate nested objects within a nested object?

**URL:** https://discuss.elastic.co/t/is-it-possible-to-aggregate-nested-objects-within-a-nested-object/208867
**Category:** Logstash
**Created:** [November 21, 2019, 11:20am UTC](https://discuss.elastic.co/t/is-it-possible-to-aggregate-nested-objects-within-a-nested-object/208867 "2019-11-21T11:20:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sjez](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sjez](https://discuss.elastic.co/u/sjez)
#### Post date: [November 21, 2019, 11:20am UTC](https://discuss.elastic.co/t/is-it-possible-to-aggregate-nested-objects-within-a-nested-object/208867/1 "2019-11-21T11:20:51Z")

</div>

Hi,

I am pulling data from an oracle database using jdbc connection and then loading that into ES via logstash. Using the aggregate filter function I am successfully able to nest columns based on a task\_id and using a map for the nested object.

My question, is it possible to then further map a nested object below this nested object? I am struggling to work out what the syntax might look like.

My current filter is below so for each course\_id there could be 1 or more opportunity\_id this is working fine. I then need to add further child object for each opportunity\_id is this possible using the aggregate filter?

filter {  
aggregate {  
task\_id =\> "%{course\_id}"  
code =\> "  
map ['institution\_id'] = event.get('institution\_id')  
map ['course\_id'] = event.get('course\_id')  
map ['opportunity\_detail'] ||=   
map ['opportunity\_detail'] \<\< { 'opportunity\_id' =\> event.get('opportunity\_id'), 'local\_per\_year\_fees' =\> event.get('local\_per\_year\_fees'),'length\_of\_study\_months' =\> event.get('length\_of\_study\_months'),'int\_study\_mode\_id' =\> event.get('int\_study\_mode\_id'),'venue\_id' =\> event.get('venue\_id')}  
map ['search\_detail'] ||=   
map ['search\_detail'] \<\< { 'er\_qual\_grade\_id' =\> event.get('er\_qual\_grade\_id'), 'er\_qual\_id' =\> event.get('er\_qual\_id'),'grade\_value' =\> event.get('grade\_value'),'group\_id' =\> event.get('group\_id'),'hierarchy\_order' =\> event.get('hierarchy\_order')}  
"  
timeout\_tags =\> ["aggregate"]  
push\_previous\_map\_as\_event =\> true  
timeout =\> 5  
}  
}

---

<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 19, 2019, 11:20am UTC](https://discuss.elastic.co/t/is-it-possible-to-aggregate-nested-objects-within-a-nested-object/208867/2 "2019-12-19T11:20:55Z")

</div>

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