# Aggregate contains old values

**URL:** <https://discuss.elastic.co/t/aggregate-contains-old-values/78685>\
**Category:** Elasticsearch\
**Created:** [March 15, 2017, 11:16am UTC](https://discuss.elastic.co/t/aggregate-contains-old-values/78685 "2017-03-15T11:16:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![upjective.srn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/upjective.srn/32/16362_2.png) [@upjective.srn](https://discuss.elastic.co/u/upjective.srn)\
**Post date:** [March 15, 2017, 11:16am UTC](https://discuss.elastic.co/t/aggregate-contains-old-values/78685/1 "2017-03-15T11:16:18Z")

</div>

Hey there,

I'm having some problems with aggregations returning old data. When I query directly using `bool/must/term` the data is not there - as it should. Only in aggregation results.

1. I have a property called `foo`.
2. Then I introduced a new property called `bar`.
3. Then I updated all the documents where `foo` had the value `x` to `y` and updated `bar` to have the value `x`.

Querying directly for `foo` = `x` yields 0 results, as it should.  
Querying directly for `bar` = `x` yields 10 results, as it should.

When aggregating `foo` and `bar` I receive `x` in the `foo` property (with `doc_count` = `0`) and the `bar` property.  
I expect to only see the `x` values in the `bar` property.

Elasticsearch version `2.3.5` running in Elastic Cloud.

Note: when I removed the index completely and populated the index again, everthing was working as it should. It only appears to be happening on existing indices.

Is there any logical explanation for this? I'm aware of `doc_count` being approximate, but I guess that's a completely different thing.

---

<div class="post-metadata">

**Author:** ![alexbrasetvik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexbrasetvik/32/15538_2.png) [@alexbrasetvik](https://discuss.elastic.co/u/alexbrasetvik)\
**Post date:** [March 15, 2017, 9:46pm UTC](https://discuss.elastic.co/t/aggregate-contains-old-values/78685/2 "2017-03-15T21:46:53Z")

</div>

Moved to Elasticsearch topic as this is not a Cloud infrastructure issue.

---

<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:** [March 18, 2017, 9:47pm UTC](https://discuss.elastic.co/t/aggregate-contains-old-values/78685/3 "2017-03-18T21:47:01Z")

</div>

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