[source, ruby]
----
response = client.cluster.put_component_template(
  name: 'my-weather-sensor-mappings',
  body: {
    template: {
      mappings: {
        properties: {
          sensor_id: {
            type: 'keyword',
            time_series_dimension: true
          },
          location: {
            type: 'keyword',
            time_series_dimension: true
          },
          temperature: {
            type: 'half_float',
            time_series_metric: 'gauge'
          },
          humidity: {
            type: 'half_float',
            time_series_metric: 'gauge'
          },
          "@timestamp": {
            type: 'date',
            format: 'strict_date_optional_time'
          }
        }
      }
    },
    _meta: {
      description: 'Mappings for weather sensor data'
    }
  }
)
puts response
----
