# Reindex API aggregations

**URL:** <https://discuss.elastic.co/t/reindex-api-aggregations/87790>\
**Category:** Elasticsearch\
**Created:** [May 31, 2017, 5:40pm UTC](https://discuss.elastic.co/t/reindex-api-aggregations/87790 "2017-05-31T17:40:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![NounouGeek](https://avatars.discourse-cdn.com/v4/letter/n/cc9497/32.png) [@NounouGeek](https://discuss.elastic.co/u/NounouGeek)\
**Post date:** [May 31, 2017, 5:40pm UTC](https://discuss.elastic.co/t/reindex-api-aggregations/87790/1 "2017-05-31T17:40:01Z")

</div>

Hello,

I'd like to know how to use Reindex API with aggregations inside query?  
Let me explain. :  
I've an index called index\_1 with over 30 millions documents (API Logs)  
**id, Login, visited\_page, timestamp, browser, status\_code**  
1 [xxxxx@xxxx.xxx](mailto:xxxxx@xxxx.xxx), xxxxx, 2017-01-12 23:33:00, iPhone, 200  
2 yyyyy@yyyy.yyy, yyyyyy, 2017-01-12 13:35:30, Android, 200  
3 [xxxxx@xxxx.xxx](mailto:xxxxx@xxxx.xxx), xxxxx, 2017-01-11 15:12:23, iPhone, 200  
4 [xxxxx@xxxx.xxx](mailto:xxxxx@xxxx.xxx), xxxxx, 2017-01-12 10:46:41, iPhone, 200

.....

I'd like the create a new index (aggregated index), that contains one line/login with all statistics:  
result:  
**Login,total\_count\_connection, count\_connection\_day, date\_first\_connection, date\_last\_connection, count\_failed\_connection**  
[xxxxx@xxxx.xxx](mailto:xxxxx@xxxx.xxx), 140, 3, 2017-01-12 23-33-00, 2017-01-01 13:34:56, 3

Need help.  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [May 31, 2017, 5:45pm UTC](https://discuss.elastic.co/t/reindex-api-aggregations/87790/2 "2017-05-31T17:45:56Z")

</div>

Check out the guidance on entity centric indexing: [https://www.youtube.com/watch?v=yBf7oeJKH2Y](https://www.youtube.com/watch?v=yBf7oeJKH2Y)  
Example data and entity update scripts using Painless are here: [http://bit.ly/entcent\_painless](http://bit.ly/entcent_painless)

---

<div class="post-metadata">

**Author:** ![NounouGeek](https://avatars.discourse-cdn.com/v4/letter/n/cc9497/32.png) [@NounouGeek](https://discuss.elastic.co/u/NounouGeek)\
**Post date:** [June 1, 2017, 9:40am UTC](https://discuss.elastic.co/t/reindex-api-aggregations/87790/3 "2017-06-01T09:40:33Z")

</div>

Thanks for relpy.

Is it the only way to make an aggregated index (need pyton), or is it possible to do it with logstash or directly on elasticseach (Reindex API)?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 1, 2017, 10:21am UTC](https://discuss.elastic.co/t/reindex-api-aggregations/87790/4 "2017-06-01T10:21:29Z")

</div>

> [@NounouGeek](#):
>
> Is it the only way to make an aggregated index (need pyton),

Any client language that can use the REST api can make these calls to scroll the latest data from your event store and bundle up bulk updates to your entity store.

---

<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:** [June 29, 2017, 10:21am UTC](https://discuss.elastic.co/t/reindex-api-aggregations/87790/5 "2017-06-29T10:21:51Z")

</div>

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