# How can i insert the history data into the data stream

**URL:** <https://discuss.elastic.co/t/how-can-i-insert-the-history-data-into-the-data-stream/318081>\
**Category:** Elasticsearch\
**Tags:** datastreams\
**Created:** [November 3, 2022, 8:46am UTC](https://discuss.elastic.co/t/how-can-i-insert-the-history-data-into-the-data-stream/318081 "2022-11-03T08:46:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bo8888](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@bo8888](https://discuss.elastic.co/u/bo8888)\
**Post date:** [November 3, 2022, 8:46am UTC](https://discuss.elastic.co/t/how-can-i-insert-the-history-data-into-the-data-stream/318081/1 "2022-11-03T08:46:39Z")

</div>

```auto
{
  "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

```auto
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!

---

<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:** [November 4, 2022, 1:35am UTC](https://discuss.elastic.co/t/how-can-i-insert-the-history-data-into-the-data-stream/318081/2 "2022-11-04T01:35:35Z")

</div>

Is this related to [How can i insert the history data into TSDB](https://discuss.elastic.co/t/how-can-i-insert-the-history-data-into-tsdb/318075)?

---

<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:** [November 4, 2022, 9:53am UTC](https://discuss.elastic.co/t/how-can-i-insert-the-history-data-into-the-data-stream/318081/3 "2022-11-04T09:53:23Z")

</div>

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.

---

<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:** [December 2, 2022, 9:54am UTC](https://discuss.elastic.co/t/how-can-i-insert-the-history-data-into-the-data-stream/318081/4 "2022-12-02T09:54:20Z")

</div>

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