# How can I save the results of the DSL query directly to another index?

**URL:** <https://discuss.elastic.co/t/how-can-i-save-the-results-of-the-dsl-query-directly-to-another-index/156008>\
**Category:** Elasticsearch\
**Created:** [November 9, 2018, 8:59am UTC](https://discuss.elastic.co/t/how-can-i-save-the-results-of-the-dsl-query-directly-to-another-index/156008 "2018-11-09T08:59:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fookfook](https://avatars.discourse-cdn.com/v4/letter/f/b5a626/32.png) [@fookfook](https://discuss.elastic.co/u/fookfook)\
**Post date:** [November 9, 2018, 8:59am UTC](https://discuss.elastic.co/t/how-can-i-save-the-results-of-the-dsl-query-directly-to-another-index/156008/1 "2018-11-09T08:59:43Z")

</div>

It's like executing the following SQL statement:  
INSERT INTO ANOTHER\_TABLE SELECT \* FROM ONE\_TABLE WHERE age BETWEEN 16 AND 45;

Thank you very much for your answer:)

---

<div class="post-metadata">

**Author:** ![mats990](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mats990/32/37516_2.png) [@mats990](https://discuss.elastic.co/u/mats990)\
**Post date:** [November 9, 2018, 9:02am UTC](https://discuss.elastic.co/t/how-can-i-save-the-results-of-the-dsl-query-directly-to-another-index/156008/2 "2018-11-09T09:02:23Z")

</div>

You should take a look at reindex API [https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html)

---

<div class="post-metadata">

**Author:** ![fookfook](https://avatars.discourse-cdn.com/v4/letter/f/b5a626/32.png) [@fookfook](https://discuss.elastic.co/u/fookfook)\
**Post date:** [November 9, 2018, 9:11am UTC](https://discuss.elastic.co/t/how-can-i-save-the-results-of-the-dsl-query-directly-to-another-index/156008/3 "2018-11-09T09:11:40Z")

</div>

Great! that's the answer I want!!  
In addition to being able to copy one index to another, reindex also supports adding query parameters  
Thank you~

---

<div class="post-metadata">

**Author:** ![mats990](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mats990/32/37516_2.png) [@mats990](https://discuss.elastic.co/u/mats990)\
**Post date:** [November 9, 2018, 9:15am UTC](https://discuss.elastic.co/t/how-can-i-save-the-results-of-the-dsl-query-directly-to-another-index/156008/4 "2018-11-09T09:15:14Z")

</div>

I'm glad to help

---

<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 7, 2018, 9:17am UTC](https://discuss.elastic.co/t/how-can-i-save-the-results-of-the-dsl-query-directly-to-another-index/156008/5 "2018-12-07T09:17:46Z")

</div>

Closed on December 7, 2018, 9:17am UTC

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