[source, ruby]
----
response = client.cluster.put_component_template(
  name: 'ct1',
  body: {
    template: {
      settings: {
        'index.number_of_shards' => 2
      }
    }
  }
)
puts response

response = client.cluster.put_component_template(
  name: 'ct2',
  body: {
    template: {
      settings: {
        'index.number_of_replicas' => 0
      },
      mappings: {
        properties: {
          "@timestamp": {
            type: 'date'
          }
        }
      }
    }
  }
)
puts response

response = client.indices.put_index_template(
  name: 'final-template',
  body: {
    index_patterns: [
      'my-index-*'
    ],
    composed_of: [
      'ct1',
      'ct2'
    ],
    priority: 5
  }
)
puts response
----
