How can i insert the history data into the data stream

{
  "index_templates": [
    {
      "name": "my-weather-sensor-index-template",
      "index_template": {
        "index_patterns": [
          "metrics-weather_sensors-*"
        ],
        "template": {
          "settings": {
            "index": {
              "mode": "time_series",
              "routing_path": [
                "sensor_id",
                "location"
              ],
              "time_series": {
                "end_time": "2099-05-06T16:21:15.000Z",
                "start_time": "2016-05-06T16:21:15.000Z"
              }
            }
          }
        },
        "composed_of": [
          "my-weather-sensor-mappings",
          "my-weather-sensor-settings"
        ],
        "priority": 500,
        "data_stream": {
          "hidden": false,
          "allow_custom_routing": false
        }
      }
    }
  ]
}

I insert one doc

POST metrics-weather_sensors-dev/_doc
{
  "@timestamp": "2018-05-06T16:21:15.000Z",
  "sensor_id": "SYKENET-000002",
  "location": "swamp",
  "temperature": 32.4,
  "humidity": 88.9
}

but it is save into the back indices
.ds-metrics-weather_sensors-u-2022.11.03-000001

if I want it save in
.ds-metrics-weather_sensors-u-2018.05.06-000001

how can i do it?

thanks!

Is this related to How can i insert the history data into TSDB?

When you create a data stream (regular or tsdb), you can't control the name of the backing indices it create. The date part in the index name just represents when the backing index is created.

The name of the backing index shouldn't be important if you use data streams. It is just a name. It isn't important for the working of data streams or tsdb, because the way you interact with data streams is by using the data stream name.

1 Like

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