# Using Time Serie DataStream (TSDS) for discrete events with high cardinality

**URL:** <https://discuss.elastic.co/t/using-time-serie-datastream-tsds-for-discrete-events-with-high-cardinality/330679>\
**Category:** Elasticsearch\
**Tags:** datastreams\
**Created:** [April 24, 2023, 4:57pm UTC](https://discuss.elastic.co/t/using-time-serie-datastream-tsds-for-discrete-events-with-high-cardinality/330679 "2023-04-24T16:57:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marchelune](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marchelune/32/112334_2.png) [@Marchelune](https://discuss.elastic.co/u/Marchelune)\
**Post date:** [April 24, 2023, 4:57pm UTC](https://discuss.elastic.co/t/using-time-serie-datastream-tsds-for-discrete-events-with-high-cardinality/330679/1 "2023-04-24T16:57:04Z")

</div>

Hi there!  
I'm new to TSDS and time series in general. Let's say I have the following index mapping:

```auto
{
    "properties": {
        "@timestamp": {
            "type": "date"
        },
        "game_id": {
            "time_series_dimension": true,
            "type": "keyword"
        },
        "session": {
            "properties": {
                "id": {
                    "time_series_dimension": true,
                    "type": "keyword"
                }
            }
        },
        "event": {
            "properties": {
                "occurrences_count": {
                    "time_series_metric": "gauge",
                    "type": "long"
                },
                "time_spent_in_seconds": {
                    "time_series_metric": "gauge",
                    "type": "long"
                },
                "action": {
                    "type": "keyword"
                }
            }
        }
    }
}

```

I have many games that users play on their devices, and there are various events I want to store to analyse their behaviour.

I'd enjoy having a bit more guidance from the documentation on the TSDS use-cases and how to design a data pipeline that uses TSDS.  
For instance, it was not clear when to use the `gauge` or `counter` metrics (at least for me), and I ran into the issue of not understanding why I couldn't get a `sum` aggregation over all my event\_count (which I typed with the `time_series_metric` set to `counter`). Thanks to [this comment](https://github.com/elastic/elasticsearch/issues/93539#issuecomment-1420473031) I think I got a better understanding, and my "occurrences\_count" should actually be a gauge, if I'm not mistaken.

Similarly, it is not crystal clear for me what to choose as a dimension, especially in the scenario where one dimension may have values with a high cardinality.

The doc makes sense when you think of temperature or CPU usage sensors, but would you recommend TSDS for discrete events with high cardinality on some dimensions? Or should a regular datastream with timestamp be the preferred solution?

---

<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 22, 2023, 4:57pm UTC](https://discuss.elastic.co/t/using-time-serie-datastream-tsds-for-discrete-events-with-high-cardinality/330679/2 "2023-05-22T16:57:55Z")

</div>

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