40 lines
596 B
Plaintext
40 lines
596 B
Plaintext
// This file is autogenerated, DO NOT EDIT
|
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
|
|
|
[source, js]
|
|
----
|
|
const response0 = await client.index({
|
|
index: 'my_index',
|
|
id: '1',
|
|
refresh: true,
|
|
body: {
|
|
product: 'chocolate',
|
|
price: [
|
|
20,
|
|
4
|
|
]
|
|
}
|
|
})
|
|
console.log(response0)
|
|
|
|
const response1 = await client.search({
|
|
body: {
|
|
query: {
|
|
term: {
|
|
product: 'chocolate'
|
|
}
|
|
},
|
|
sort: [
|
|
{
|
|
price: {
|
|
order: 'asc',
|
|
mode: 'avg'
|
|
}
|
|
}
|
|
]
|
|
}
|
|
})
|
|
console.log(response1)
|
|
----
|
|
|