Files
elasticsearch-js/docs/doc_examples/dbb8fa2b8af6db66cf75ca4b83c0fb21.asciidoc
2024-09-30 13:37:11 -05:00

69 lines
1.2 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.create({
index: "my-index-000002",
mappings: {
properties: {
metrics: {
type: "object",
subobjects: "auto",
properties: {
inner: {
type: "object",
enabled: false,
},
nested: {
type: "nested",
},
},
},
},
},
});
console.log(response);
const response1 = await client.index({
index: "my-index-000002",
id: "metric_1",
document: {
"metrics.time": 100,
"metrics.time.min": 10,
"metrics.time.max": 900,
},
});
console.log(response1);
const response2 = await client.index({
index: "my-index-000002",
id: "metric_2",
document: {
metrics: {
time: 100,
"time.min": 10,
"time.max": 900,
inner: {
foo: "bar",
"path.to.some.field": "baz",
},
nested: [
{
id: 10,
},
{
id: 1,
},
],
},
},
});
console.log(response2);
const response3 = await client.indices.getMapping({
index: "my-index-000002",
});
console.log(response3);
----