46 lines
1.0 KiB
Plaintext
46 lines
1.0 KiB
Plaintext
// 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: "my-weather-sensor-index-template",
|
|
index_patterns: ["metrics-weather_sensors-*"],
|
|
data_stream: {},
|
|
template: {
|
|
settings: {
|
|
"index.mode": "time_series",
|
|
"index.lifecycle.name": "my-lifecycle-policy",
|
|
},
|
|
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",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
priority: 500,
|
|
_meta: {
|
|
description: "Template for my weather sensor data",
|
|
},
|
|
});
|
|
console.log(response);
|
|
----
|