# JDBC input type "store output into single field"

**URL:** <https://discuss.elastic.co/t/jdbc-input-type-store-output-into-single-field/243169>\
**Category:** Logstash\
**Created:** [July 30, 2020, 7:05am UTC](https://discuss.elastic.co/t/jdbc-input-type-store-output-into-single-field/243169 "2020-07-30T07:05:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rguptarg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rguptarg/32/60643_2.png) [@rguptarg](https://discuss.elastic.co/u/rguptarg)\
**Post date:** [July 30, 2020, 7:05am UTC](https://discuss.elastic.co/t/jdbc-input-type-store-output-into-single-field/243169/1 "2020-07-30T07:05:41Z")

</div>

Hi,

I am using jdbc input type and execute the oracle query, is it possible to store query output into a single variable/field ?

## Query Output : - ID

100  
101  
102

Above output store into three different JSON into elastic, but I am looking single JSON with all query output into single field.

---

<div class="post-metadata">

**Author:** ![Jenni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jenni/32/29684_2.png) [@Jenni](https://discuss.elastic.co/u/Jenni)\
**Post date:** [July 30, 2020, 10:37am UTC](https://discuss.elastic.co/t/jdbc-input-type-store-output-into-single-field/243169/2 "2020-07-30T10:37:38Z")

</div>

**Option A** : Configure an input that only emits a single event, e.g. JDBC with a query that returns nothing but the latest ID, so you have a starting point. Then use a Jdbc\_streaming filter for the actual query that returns multiple rows. Then there would be only one result with all the rows in one field. In the last step one could restructure the fields with Ruby as one pleases.  
**Option B** : Execute your usual query that returns multiple events. Use an aggregate filter and in the code for the aggregation you would append the current event's ID to an array of IDs in the aggregation map and cancel the event. Then you would either need a timeout or a condition to detect when to push the map data as an event.

---

<div class="post-metadata">

**Author:** ![rguptarg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rguptarg/32/60643_2.png) [@rguptarg](https://discuss.elastic.co/u/rguptarg)\
**Post date:** [July 31, 2020, 7:29am UTC](https://discuss.elastic.co/t/jdbc-input-type-store-output-into-single-field/243169/3 "2020-07-31T07:29:39Z")

</div>

Thanks

---

<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:** [August 28, 2020, 7:29am UTC](https://discuss.elastic.co/t/jdbc-input-type-store-output-into-single-field/243169/4 "2020-08-28T07:29:49Z")

</div>

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