# Output of aggregation query to another index in elastic

**URL:** <https://discuss.elastic.co/t/output-of-aggregation-query-to-another-index-in-elastic/173313>\
**Category:** Elasticsearch\
**Created:** [March 21, 2019, 1:16pm UTC](https://discuss.elastic.co/t/output-of-aggregation-query-to-another-index-in-elastic/173313 "2019-03-21T13:16:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DSPN](https://avatars.discourse-cdn.com/v4/letter/d/c89c15/32.png) [@DSPN](https://discuss.elastic.co/u/DSPN)\
**Post date:** [March 21, 2019, 1:16pm UTC](https://discuss.elastic.co/t/output-of-aggregation-query-to-another-index-in-elastic/173313/1 "2019-03-21T13:16:14Z")

</div>

I have an index in elastic like below. Is there an optimum way to store the aggregation of the below data into another index. I use logstash to index the original data.

**Original Data**

|SerialNo|Src|SubSrc|Filename|Status|  
|1|Source1|s1|File1|Success|  
|2|Source1|s1|file1|Error|  
|3|Source1|s1|file1|Success|  
|4|Source2|s2|file2|Success|  
|5|Source2|s2|file2|Error|  
|6|Source2|s2|file2|Error|  
|7|Source3|s3|file3|Success|

**Aggregated data**

|Src|SubSrc|Filename|Status|Count|  
|Source1|s1|File1|Success|2|  
|Source1|s1|file1|Error|1|  
|Source2|s2|file2|Success|1|  
|Source2|s2|file2|Error|2|  
|Source3|s3|file3|Success|1|

---

<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:** [April 18, 2019, 1:16pm UTC](https://discuss.elastic.co/t/output-of-aggregation-query-to-another-index-in-elastic/173313/2 "2019-04-18T13:16:23Z")

</div>

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