# Elasticsearch terms aggregation and querrying

**URL:** https://discuss.elastic.co/t/elasticsearch-terms-aggregation-and-querrying/192748
**Category:** Elasticsearch
**Created:** [July 29, 2019, 5:06pm UTC](https://discuss.elastic.co/t/elasticsearch-terms-aggregation-and-querrying/192748 "2019-07-29T17:06:25Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [July 29, 2019, 5:18pm UTC](https://discuss.elastic.co/t/elasticsearch-terms-aggregation-and-querrying/192748/2 "2019-07-29T17:18:15Z")

</div>

Assuming there's a large number of unique messageIDs this is one of those tricky problems to do for any distributed data store.  
You'll likely need to maintain an entity-centric index keyed on the message ID rather than attempting this analysis on a purely log-centric index.

Here's a link to [why entity centric indexes are sometimes required](https://twitter.com/elasticmark/status/1009380268409610240). It includes some example scripts to build an entity-centric index but we also now have the [dataframes](https://www.elastic.co/guide/en/elasticsearch/reference/master/preview-data-frame-transform.html) feature in 7.2 which can also fuse related data around an ID.

---

_[View the full topic](https://discuss.elastic.co/t/elasticsearch-terms-aggregation-and-querrying/192748)._
