# Create a new index with the query's result

**URL:** https://discuss.elastic.co/t/create-a-new-index-with-the-querys-result/347353
**Category:** Elasticsearch
**Created:** [November 16, 2023, 4:46pm UTC](https://discuss.elastic.co/t/create-a-new-index-with-the-querys-result/347353 "2023-11-16T16:46:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Mathieu64](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@Mathieu64](https://discuss.elastic.co/u/Mathieu64)
#### Post date: [November 16, 2023, 4:46pm UTC](https://discuss.elastic.co/t/create-a-new-index-with-the-querys-result/347353/1 "2023-11-16T16:46:28Z")

</div>

Hi,

I want to send the query's result in a new index :

```auto
GET myindex/_search
{
  "size" : 0,
  "_source" : false,
  "aggregations" : {
    "groupby" : {
      "composite" : {
        "size" : 1000,
        "sources" : [
          {
            "e2762d6b" : {
              "terms" : {
                "field" : "field1",
                "missing_bucket" : true,
                "order" : "asc"
              }
            }
          },
          {
            "d3aa500c" : {
              "terms" : {
                "field" : "field2",
                "missing_bucket" : true,
                "order" : "asc"
              }
            }
          }
        ]
      }
    }
  }
}

```

Can you indicate to me how I can do that ?

---

<div class="post-metadata">

### Author: ![Priscilla\_Parodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priscilla_parodi/32/43047_2.png) [@Priscilla\_Parodi](https://discuss.elastic.co/u/Priscilla_Parodi)
#### Post date: [November 28, 2023, 2:00pm UTC](https://discuss.elastic.co/t/create-a-new-index-with-the-querys-result/347353/2 "2023-11-28T14:00:26Z")

</div>

Hello @Mathieu64,

Welcome to the community!

You would have a separate request for this.

> **[Index API | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html)**

---

<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 26, 2023, 2:01pm UTC](https://discuss.elastic.co/t/create-a-new-index-with-the-querys-result/347353/3 "2023-12-26T14:01:03Z")

</div>

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