38 lines
776 B
Plaintext
38 lines
776 B
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.create({
|
|
index: "my-index-000001",
|
|
mappings: {
|
|
properties: {
|
|
timestamp: {
|
|
type: "date",
|
|
},
|
|
temperature: {
|
|
type: "long",
|
|
},
|
|
voltage: {
|
|
type: "double",
|
|
},
|
|
node: {
|
|
type: "keyword",
|
|
},
|
|
voltage_corrected: {
|
|
type: "double",
|
|
on_script_error: "fail",
|
|
script: {
|
|
source:
|
|
"\n emit(doc['voltage'].value * params['multiplier'])\n ",
|
|
params: {
|
|
multiplier: 4,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
----
|