(cherry picked from commit f737290d10)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
54 lines
1.1 KiB
Plaintext
54 lines
1.1 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.cluster.putComponentTemplate({
|
|
name: "destination_template",
|
|
template: {
|
|
settings: {
|
|
index: {
|
|
number_of_replicas: 0,
|
|
number_of_shards: 4,
|
|
mode: "time_series",
|
|
routing_path: ["metricset"],
|
|
time_series: {
|
|
end_time: "2023-09-01T14:00:00.000Z",
|
|
start_time: "2023-09-01T06:00:00.000Z",
|
|
},
|
|
},
|
|
},
|
|
mappings: {
|
|
properties: {
|
|
"@timestamp": {
|
|
type: "date",
|
|
},
|
|
metricset: {
|
|
type: "keyword",
|
|
time_series_dimension: true,
|
|
},
|
|
k8s: {
|
|
properties: {
|
|
tx: {
|
|
type: "long",
|
|
},
|
|
rx: {
|
|
type: "long",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.indices.putIndexTemplate({
|
|
name: 2,
|
|
index_patterns: ["k8s*"],
|
|
composed_of: ["destination_template"],
|
|
data_stream: {},
|
|
});
|
|
console.log(response1);
|
|
----
|