# Elasticsearch(7.8) NEST(C#) aggregations

**URL:** <https://discuss.elastic.co/t/elasticsearch-7-8-nest-c-aggregations/248094>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [September 10, 2020, 1:35am UTC](https://discuss.elastic.co/t/elasticsearch-7-8-nest-c-aggregations/248094 "2020-09-10T01:35:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph\_Tucci](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joseph_tucci/32/75328_2.png) [@Joseph\_Tucci](https://discuss.elastic.co/u/Joseph_Tucci)\
**Post date:** [September 10, 2020, 1:35am UTC](https://discuss.elastic.co/t/elasticsearch-7-8-nest-c-aggregations/248094/1 "2020-09-10T01:35:41Z")

</div>

document count ~10 billion documents  
elastics disk usage ~2TB  
elasticsearch 7.8 via NEST/C# api.

my model is a transaction receipt. a simplified schema

```auto
[keyword]
string customer_id { get; set; } //cardinality 100M
[keyword]
string employee_id { get; set; } //cardinality ~5M
[keyword]
string store_zip { get; set; } //cardinality 100k
[keyword]
List<string> codes { get; set; } //can be up to 25 - cardinality ~300k

```

For this phase I want counts of term aggregations per customer or employee. I believe a composite aggregation can get me this 'pivot' from transactions to customers or employee.

I have one use case that I can not figure out: Filter customers that have made 2 or more purchases of a particular set of codes.

As an example  
Filter by customer that have made \>=2 purchases with codes { "A1", "A2", A3" }  
then  
Aggregate by customer by top 4 zip codes

Any guidance would be helpful.

Thank you for your time in advance

---

<div class="post-metadata">

**Author:** ![Joseph\_Tucci](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joseph_tucci/32/75328_2.png) [@Joseph\_Tucci](https://discuss.elastic.co/u/Joseph_Tucci)\
**Post date:** [September 10, 2020, 4:14pm UTC](https://discuss.elastic.co/t/elasticsearch-7-8-nest-c-aggregations/248094/2 "2020-09-10T16:14:47Z")

</div>

Mark harwood has a great presentation about modeling event data as entity data to handle queries that are too expensive during search.

[https://www.elastic.co/videos/entity-centric-indexing-mark-harwood](https://www.elastic.co/videos/entity-centric-indexing-mark-harwood)

---

<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:** [October 8, 2020, 4:14pm UTC](https://discuss.elastic.co/t/elasticsearch-7-8-nest-c-aggregations/248094/3 "2020-10-08T16:14:51Z")

</div>

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