45 lines
714 B
Plaintext
45 lines
714 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: "mv",
|
|
mappings: {
|
|
properties: {
|
|
b: {
|
|
type: "long",
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.bulk({
|
|
index: "mv",
|
|
refresh: "true",
|
|
operations: [
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
a: 1,
|
|
b: [2, 2, 1],
|
|
},
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
a: 2,
|
|
b: [1, 1],
|
|
},
|
|
],
|
|
});
|
|
console.log(response1);
|
|
|
|
const response2 = await client.esql.query({
|
|
query: "FROM mv | EVAL b=TO_STRING(b) | LIMIT 2",
|
|
});
|
|
console.log(response2);
|
|
----
|