53 lines
757 B
Plaintext
53 lines
757 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.bulk({
|
|
index: "test",
|
|
refresh: "true",
|
|
operations: [
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
s: 1,
|
|
m: 3.1415,
|
|
},
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
s: 2,
|
|
m: 1,
|
|
},
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
s: 3,
|
|
m: 2.71828,
|
|
},
|
|
],
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.search({
|
|
index: "test",
|
|
filter_path: "aggregations",
|
|
aggs: {
|
|
tm: {
|
|
top_metrics: {
|
|
metrics: {
|
|
field: "m",
|
|
},
|
|
sort: {
|
|
s: "desc",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response1);
|
|
----
|