# Type of Long not valid in time series dimension

**URL:** <https://discuss.elastic.co/t/type-of-long-not-valid-in-time-series-dimension/329464>\
**Category:** Elasticsearch\
**Tags:** datastreams\
**Created:** [April 5, 2023, 8:51pm UTC](https://discuss.elastic.co/t/type-of-long-not-valid-in-time-series-dimension/329464 "2023-04-05T20:51:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![A\_Mightiev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_mightiev/32/62186_2.png) [@A\_Mightiev](https://discuss.elastic.co/u/A_Mightiev)\
**Post date:** [April 5, 2023, 8:51pm UTC](https://discuss.elastic.co/t/type-of-long-not-valid-in-time-series-dimension/329464/1 "2023-04-05T20:51:49Z")

</div>

Hi  
Is this a bug? I can't use a type long field for a time\_series\_dimension. this is a simple example:

```auto
PUT /temperature01
{
    "settings": {
        "index": {
            "mode": "time_series",
            "time_series": {
                "start_time": "2023-01-01T00:00:00Z",
                "end_time": "2023-01-03T23:59:59Z"
            },
            "routing_path": [
                "thermometer.id"
            ],
            "number_of_replicas": 0,
            "number_of_shards": 1
        }
    },
    "mappings": {
        "properties": {
            "@timestamp": {
                "type": "date"
            },
            "thermometer": {
                "properties": {
                    "id": {
                        "type": "long",
                        "time_series_dimension": true
                    },
                    "value": {
                        "type": "long",
                        "time_series_metric": "gauge"
                    }
                }
            }
        }
    }
}

```

If I change it to keyword the thermometer.id then it works, but in the documentation it says it should accept type Long

> **[Time series data stream (TSDS) | Elasticsearch Guide \[8.7\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/tsds.html#time-series-dimension)**

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 6, 2023, 1:01am UTC](https://discuss.elastic.co/t/type-of-long-not-valid-in-time-series-dimension/329464/2 "2023-04-06T01:01:37Z")

</div>

I just tried it and it accepted the mapping, are you getting some kind of error there?

---

<div class="post-metadata">

**Author:** ![A\_Mightiev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_mightiev/32/62186_2.png) [@A\_Mightiev](https://discuss.elastic.co/u/A_Mightiev)\
**Post date:** [April 6, 2023, 7:37am UTC](https://discuss.elastic.co/t/type-of-long-not-valid-in-time-series-dimension/329464/3 "2023-04-06T07:37:43Z")

</div>

sorry made a typo on on the script, "themometer.id" should be "thermometer.id". I updated it in my post  
So the error I get is this

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "All fields that match routing_path must be keywords with [time_series_dimension: true] and without the [script] parameter. [thermometer.id] was [long]."
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "All fields that match routing_path must be keywords with [time_series_dimension: true] and without the [script] parameter. [thermometer.id] was [long]."
  },
  "status": 400
}

```

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [April 6, 2023, 8:44am UTC](https://discuss.elastic.co/t/type-of-long-not-valid-in-time-series-dimension/329464/4 "2023-04-06T08:44:45Z")

</div>

Thanks for raising this. This is a current limitation, a routing field need to be a keyword field.  
I'm not sure whether this limitation can be lifted. But it makes sense to me to open an issue for this.

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [April 6, 2023, 8:52am UTC](https://discuss.elastic.co/t/type-of-long-not-valid-in-time-series-dimension/329464/5 "2023-04-06T08:52:18Z")

</div>

I've opened this issue: [Allow number fields as routing fields? · Issue #95069 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/95069)  
Note that this limitation is documented: [Time series data stream (TSDS) | Elasticsearch Guide [8.7] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/tsds.html#dimension-based-routing)

---

<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 4, 2023, 8:52am UTC](https://discuss.elastic.co/t/type-of-long-not-valid-in-time-series-dimension/329464/6 "2023-05-04T08:52:45Z")

</div>

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