[source, ruby]
----
response = client.indices.put_index_template(
  name: 'my-data-stream-template',
  body: {
    index_patterns: [
      'my-data-stream*'
    ],
    data_stream: {},
    template: {
      settings: {
        index: {
          mode: 'time_series',
          routing_path: [
            'kubernetes.namespace',
            'kubernetes.host',
            'kubernetes.node',
            'kubernetes.pod'
          ],
          number_of_replicas: 0,
          number_of_shards: 2
        }
      },
      mappings: {
        properties: {
          "@timestamp": {
            type: 'date'
          },
          kubernetes: {
            properties: {
              container: {
                properties: {
                  cpu: {
                    properties: {
                      usage: {
                        properties: {
                          core: {
                            properties: {
                              ns: {
                                type: 'long'
                              }
                            }
                          },
                          limit: {
                            properties: {
                              pct: {
                                type: 'float'
                              }
                            }
                          },
                          nanocores: {
                            type: 'long',
                            time_series_metric: 'gauge'
                          },
                          node: {
                            properties: {
                              pct: {
                                type: 'float'
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  memory: {
                    properties: {
                      available: {
                        properties: {
                          bytes: {
                            type: 'long',
                            time_series_metric: 'gauge'
                          }
                        }
                      },
                      majorpagefaults: {
                        type: 'long'
                      },
                      pagefaults: {
                        type: 'long',
                        time_series_metric: 'gauge'
                      },
                      rss: {
                        properties: {
                          bytes: {
                            type: 'long',
                            time_series_metric: 'gauge'
                          }
                        }
                      },
                      usage: {
                        properties: {
                          bytes: {
                            type: 'long',
                            time_series_metric: 'gauge'
                          },
                          limit: {
                            properties: {
                              pct: {
                                type: 'float'
                              }
                            }
                          },
                          node: {
                            properties: {
                              pct: {
                                type: 'float'
                              }
                            }
                          }
                        }
                      },
                      workingset: {
                        properties: {
                          bytes: {
                            type: 'long',
                            time_series_metric: 'gauge'
                          }
                        }
                      }
                    }
                  },
                  name: {
                    type: 'keyword'
                  },
                  start_time: {
                    type: 'date'
                  }
                }
              },
              host: {
                type: 'keyword',
                time_series_dimension: true
              },
              namespace: {
                type: 'keyword',
                time_series_dimension: true
              },
              node: {
                type: 'keyword',
                time_series_dimension: true
              },
              pod: {
                type: 'keyword',
                time_series_dimension: true
              }
            }
          }
        }
      }
    }
  }
)
puts response
----
