# Cardinality problem

**URL:** https://discuss.elastic.co/t/cardinality-problem/343387
**Category:** Elasticsearch
**Created:** [September 19, 2023, 4:27pm UTC](https://discuss.elastic.co/t/cardinality-problem/343387 "2023-09-19T16:27:18Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![YvorL](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@YvorL](https://discuss.elastic.co/u/YvorL)
#### Post date: [September 19, 2023, 4:27pm UTC](https://discuss.elastic.co/t/cardinality-problem/343387/1 "2023-09-19T16:27:18Z")

</div>

Hi,

I'm not sure if this can be done, but it's worth asking 🙂  
I would like to see a specific metric, but it'd need a lot of conditions and cardinality.  
Let's say I have an index where I have documents from a forum like this:

```auto
{
... (default fields),
topic_id: XXX,
subtopic_id: YYY,
thread_id: ZZZ,
commenter_id: WWW,
category: QQQ,
etc, ...
}

```

Naturally, each document has all the IDs and all other data/metadata from each comment.

I'd like to know how many topics have only one subtopic AND less than 500 unique commenters.

Apart from that problem, I was thinking that it'd be nice to know the ranges of subtopics (e.g., 1-4, 5-9, over 10), and if there's a possibility to add the category as a main identifier (split the result per category).

Thank you!

---

<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 17, 2023, 4:27pm UTC](https://discuss.elastic.co/t/cardinality-problem/343387/2 "2023-10-17T16:27:50Z")

</div>

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