# How to loop the jdbc streaming filter by pass the index of array of object?

**URL:** https://discuss.elastic.co/t/how-to-loop-the-jdbc-streaming-filter-by-pass-the-index-of-array-of-object/351784
**Category:** Logstash
**Created:** [January 25, 2024, 10:17am UTC](https://discuss.elastic.co/t/how-to-loop-the-jdbc-streaming-filter-by-pass-the-index-of-array-of-object/351784 "2024-01-25T10:17:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kishorkumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kishorkumar/32/132930_2.png) [@kishorkumar](https://discuss.elastic.co/u/kishorkumar)
#### Post date: [January 25, 2024, 10:17am UTC](https://discuss.elastic.co/t/how-to-loop-the-jdbc-streaming-filter-by-pass-the-index-of-array-of-object/351784/1 "2024-01-25T10:17:56Z")

</div>

So here is the usecase

i have the "mainSKU": [  
{  
"id": 102,  
},  
{  
"id": 101,  
},  
{  
"id": 100,  
}  
]

like this and i am using jdb\_streaming

and every mainSKU has 3 to 4 SKU

in order to that i need to loop get the every pass the index the jdbc\_streaming like this [mainSKU][index][id] like this and it will do is get all the SKU's from SKU table .

so How to do that the database is postgress.?

is it possible to pass the whole array of integers as variable in select query to avoid the loop ? if not then what's the way to that looping

---

<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: [January 25, 2024, 5:59pm UTC](https://discuss.elastic.co/t/how-to-loop-the-jdbc-streaming-filter-by-pass-the-index-of-array-of-object/351784/2 "2024-01-25T17:59:31Z")

</div>

You could use a split filter to create three (or four) events from that mainSKU, then you would have a constant field name to use in the jdbc\_streaming lookup. Then use an aggregate filter to recombine those event into one. It's not pretty, but it works.

---

<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: [February 22, 2024, 6:00pm UTC](https://discuss.elastic.co/t/how-to-loop-the-jdbc-streaming-filter-by-pass-the-index-of-array-of-object/351784/3 "2024-02-22T18:00:06Z")

</div>

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