# Composite aggregation fails with Cannot replay yet

**URL:** https://discuss.elastic.co/t/composite-aggregation-fails-with-cannot-replay-yet/135596
**Category:** Elasticsearch
**Created:** [June 12, 2018, 8:32pm UTC](https://discuss.elastic.co/t/composite-aggregation-fails-with-cannot-replay-yet/135596 "2018-06-12T20:32:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tarp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tarp/32/51884_2.png) [@tarp](https://discuss.elastic.co/u/tarp)
#### Post date: [June 12, 2018, 8:32pm UTC](https://discuss.elastic.co/t/composite-aggregation-fails-with-cannot-replay-yet/135596/1 "2018-06-12T20:32:17Z")

</div>

Hi,  
I'm working on an aggregation over an application metrics log. I have got the composite aggregate to work except when I had the section "status\_code", which is a nested aggregation, I get a 500 error with the status text of, "Cannot replay yet, collection is not finished: postCollect() has not been called"

Here's my agg query  
{  
"size": 0,  
"track\_total\_hits": false,  
"aggs": {  
"c-buckets": {  
"composite": {  
"sources": [  
{"time": {"date\_histogram": {"field": "@timestamp", "interval": "1m", "order": "asc"}}},  
{"env": {"terms": {"field": "env.keyword"}}},  
{"host": {"terms": {"field": "host.keyword"}}},  
{"proxy\_host": {"terms": {"field": "proxy\_host.keyword"}}},  
{"endpoint": {"terms": {"field": "api.endpoint.keyword"}}},  
{"accept": {"terms": {"field": "api.accept.keyword"}}},  
{"client\_key": {"terms": {"field": "api.client\_key.keyword"}}},  
{"code\_version": {"terms": {"field": "code\_version.keyword"}}}  
]  
},  
"aggs": {  
"load": {"cardinality": {"field": "api.request\_id.keyword"}},  
"threads": {"cardinality": {"field": "thread\_name.keyword"}},  
"user\_name": {"cardinality": {"field": "api.user\_name.keyword"}},  
"exceptions": {"value\_count": {"field": "stack\_hash.keyword"}},  
"elapsed\_ms": {"extended\_stats": {"field": "api.elapsed\_millis", "sigma": 1}},  
"started": {"filters": {"filters": {"start": {"match": {"message": "\ ***START**"}}}}},  
"ended": {"filters": {"filters": {"end": {"match": {"caller\_method\_name.keyword": "logEnd"}}}}},  
"long\_running": {"filters": {"filters": {  
"lr": {"match": {"caller\_file\_name.keyword": "LongRunningRequestLogger.java"}},  
"zombie": {"match": {"message": "ZOMBIE"}}  
}  
},  
"aggs": {  
"requests": {"cardinality": {"field": "api.request\_id.keyword"}}  
}  
},  
"status\_code": {"terms": {  
"field": "api.status\_code",  
"collect\_mode" : "breadth\_first"},  
"aggs": {  
"elapsed\_ms": {"extended\_stats": {"field": "api.elapsed\_millis", "sigma": 1}},  
"user\_name": {"cardinality": {"field": "api.user\_name.keyword"}},  
"threads": {"cardinality": {"field": "thread\_name.keyword"}}  
}  
}  
}  
}  
}  
}

Is this the same thing referenced here? [Metric aggregation fails in composite aggregation](https://discuss.elastic.co/t/metric-aggregation-fails-in-composite-aggregation/119933)

Thanks,

---

<div class="post-metadata">

### Author: ![tarp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tarp/32/51884_2.png) [@tarp](https://discuss.elastic.co/u/tarp)
#### Post date: [June 15, 2018, 8:46pm UTC](https://discuss.elastic.co/t/composite-aggregation-fails-with-cannot-replay-yet/135596/2 "2018-06-15T20:46:31Z")

</div>

This is working now with Elasticsearch 6.3.0

---

<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: [July 13, 2018, 8:46pm UTC](https://discuss.elastic.co/t/composite-aggregation-fails-with-cannot-replay-yet/135596/3 "2018-07-13T20:46:42Z")

</div>

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