# How to create an index\_2 containing Index\_1's aggregations results?

**URL:** <https://discuss.elastic.co/t/how-to-create-an-index-2-containing-index-1s-aggregations-results/227285>\
**Category:** Elasticsearch\
**Created:** [April 9, 2020, 9:14am UTC](https://discuss.elastic.co/t/how-to-create-an-index-2-containing-index-1s-aggregations-results/227285 "2020-04-09T09:14:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![oula\_oula](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oula_oula/32/63182_2.png) [@oula\_oula](https://discuss.elastic.co/u/oula_oula)\
**Post date:** [April 9, 2020, 9:14am UTC](https://discuss.elastic.co/t/how-to-create-an-index-2-containing-index-1s-aggregations-results/227285/1 "2020-04-09T09:14:28Z")

</div>

How to create an index\_2 containing Index\_1's aggregations results as fields ?

Is it possible to use a command like this on kibana dev tools ?

PUT /index\_2/doc\_aggs\_results\_of\_index1  
{  
field\_aggs1: ...  
field\_aggs2: ...  
{

For example:  
Index\_1 contains:  
{  
doc1:  
name : Superman  
city: New-York  
date: 01-05-2015  
}  
{  
doc2:  
name : Batman  
city: Los Angeles  
date: 22-07-2018  
}  
{  
doc3:  
name : Superman  
city: Sidney  
date: 12-10-2017  
}  
{  
doc4:  
name : Batman  
city: Paris  
date: 17-02-2018  
}

And I'd like to create index that aggregates or queries on index\_1 to make index\_2 :

Index\_2 contains:  
{  
doc1:  
name: Superman,  
cities: [  
{  
city: New-York,  
date: 01-05-2015  
},  
{  
city: Sidney,  
date: 12-10-2017  
}]  
},

{  
doc2:  
name: Batman,  
cities: [  
{  
city: Los Angeles,  
date: 22-07-2018  
},  
{  
city: Paris,  
date: 17-02-2018  
}]  
}

---

<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 7, 2020, 9:14am UTC](https://discuss.elastic.co/t/how-to-create-an-index-2-containing-index-1s-aggregations-results/227285/2 "2020-05-07T09:14:30Z")

</div>

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