// 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.cluster.putComponentTemplate({
  name: "ct1",
  template: {
    settings: {
      "index.number_of_shards": 2,
    },
  },
});
console.log(response);

const response1 = await client.cluster.putComponentTemplate({
  name: "ct2",
  template: {
    settings: {
      "index.number_of_replicas": 0,
    },
    mappings: {
      properties: {
        "@timestamp": {
          type: "date",
        },
      },
    },
  },
});
console.log(response1);

const response2 = await client.indices.putIndexTemplate({
  name: "final-template",
  index_patterns: ["my-index-*"],
  composed_of: ["ct1", "ct2"],
  priority: 5,
});
console.log(response2);

const response3 = await client.indices.simulateTemplate({
  name: "final-template",
});
console.log(response3);
----
