# How to Stack Cardinality Transforms

**URL:** https://discuss.elastic.co/t/how-to-stack-cardinality-transforms/302851
**Category:** Elasticsearch
**Tags:** transforms
**Created:** [April 20, 2022, 7:26pm UTC](https://discuss.elastic.co/t/how-to-stack-cardinality-transforms/302851 "2022-04-20T19:26:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Ashfur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashfur/32/81284_2.png) [@Ashfur](https://discuss.elastic.co/u/Ashfur)
#### Post date: [April 20, 2022, 7:26pm UTC](https://discuss.elastic.co/t/how-to-stack-cardinality-transforms/302851/1 "2022-04-20T19:26:56Z")

</div>

Hello,

This is a followup question for:

> [@Questions Regarding Deleting Source Data After Transform](https://discuss.elastic.co/t/questions-regarding-deleting-source-data-after-transform/279353):
>
> From what I read from the other posts, if we are running a continuous transform, we should not delete any data from the source index as that will trigger the transform to re-compute and the deleted records will no longer be taken into account in the summarized index after refresh. I have a few questions on that topic: Does this apply to both pivot and latest transform? If we are only interested in the summarized view and not the raw records in the source index, is there any other things we ca…

In order to delete old raw data without impacting the continuous lifetime cardinality aggregation transform, I was suggested to stack 2 transforms together. The first transform aggregated raw data into hourly summaries, then the outputs get fed into the second transform that aggregated the hourly summaries into lifetime total.

I am not sure how to set this up in practice because the output of the hourly cardinality transform is just a single integer representing how many unique values are seen in each hour, rather than some kind of data structure like HLL that can be rolled up to a higher level. Is this the right way to do this or is there a different approach?

Thanks.

---

<div class="post-metadata">

### Author: ![Hendrik\_Muhs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hendrik_muhs/32/25802_2.png) [@Hendrik\_Muhs](https://discuss.elastic.co/u/Hendrik_Muhs)
#### Post date: [April 21, 2022, 6:07am UTC](https://discuss.elastic.co/t/how-to-stack-cardinality-transforms/302851/2 "2022-04-21T06:07:52Z")

</div>

Cardinalities can not be summarized using a stacked approach. I just read my previous post again, it sounds misleading. Sorry if I have not been clear. It should say that it does _not_ work for cardinality.

There have been ideas about making HLL a native data type in Lucene, so it can be updated.

---

<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: [May 19, 2022, 6:08am UTC](https://discuss.elastic.co/t/how-to-stack-cardinality-transforms/302851/3 "2022-05-19T06:08:01Z")

</div>

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