// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples

[source, js]
----
const response = await client.indices.putIndexTemplate({
  name: "datastream_template",
  index_patterns: ["datastream*"],
  data_stream: {},
  template: {
    settings: {
      index: {
        mode: "time_series",
        number_of_replicas: 0,
        number_of_shards: 2,
      },
      "index.lifecycle.name": "datastream_policy",
    },
    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,
            },
          },
        },
      },
    },
  },
});
console.log(response);
----
