# Select into new docs

**URL:** <https://discuss.elastic.co/t/select-into-new-docs/214754>\
**Category:** Elasticsearch\
**Created:** [January 13, 2020, 5:23am UTC](https://discuss.elastic.co/t/select-into-new-docs/214754 "2020-01-13T05:23:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pieter\_Agenbag](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pieter_agenbag/32/4562_2.png) [@Pieter\_Agenbag](https://discuss.elastic.co/u/Pieter_Agenbag)\
**Post date:** [January 13, 2020, 5:23am UTC](https://discuss.elastic.co/t/select-into-new-docs/214754/1 "2020-01-13T05:23:21Z")

</div>

Hi all.

Is there a way to create a document(s) from the result of a query?  
I have a query doing some filtering and a scripted\_metric , returning a large amount of data that I would like to insert as new data set.

The query returns quickly , but having to stream the data out and then back into ES takes too long. (I need to run this ad hoc from a frontend).

I cant use the rollup-api as it doesnt support scripted metrics (and the 'special indexes' it creates)...also, the reindex api doesnt seem to support any aggregations.

Any other ideas ?

(Using ES 7.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:** [February 10, 2020, 5:24am UTC](https://discuss.elastic.co/t/select-into-new-docs/214754/2 "2020-02-10T05:24:44Z")

</div>

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