# Sink the output of an SQL Query back into an index in Elasticsearch

**URL:** <https://discuss.elastic.co/t/sink-the-output-of-an-sql-query-back-into-an-index-in-elasticsearch/229087>\
**Category:** Elasticsearch\
**Created:** [April 21, 2020, 3:57pm UTC](https://discuss.elastic.co/t/sink-the-output-of-an-sql-query-back-into-an-index-in-elasticsearch/229087 "2020-04-21T15:57:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_kumar4/32/67369_2.png) [@Rahul\_Kumar4](https://discuss.elastic.co/u/Rahul_Kumar4)\
**Post date:** [April 21, 2020, 3:57pm UTC](https://discuss.elastic.co/t/sink-the-output-of-an-sql-query-back-into-an-index-in-elasticsearch/229087/1 "2020-04-21T15:57:29Z")

</div>

Hello,

Is it possible to write the output data of an SQL query result back into a new index in Elasticsearch?

**My use case**  
I have two indices in our Elasticsearch cluster and have to perform JOIN operations to denormalize it but after that I want to write the output to a new index to query it later. Is the sinking possible? Something on the lines of how you can write the output of a KSQL query on Kafka Streams back into a new topic in Kafka.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 23, 2020, 1:34am UTC](https://discuss.elastic.co/t/sink-the-output-of-an-sql-query-back-into-an-index-in-elasticsearch/229087/2 "2020-04-23T01:34:24Z")

</div>

Not directly. You could do it with Logstash and the Elasticsearch input and output.

---

<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 21, 2020, 1:34am UTC](https://discuss.elastic.co/t/sink-the-output-of-an-sql-query-back-into-an-index-in-elasticsearch/229087/3 "2020-05-21T01:34:24Z")

</div>

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