Added/updated snippets for docs (#2318)
This commit is contained in:
37
docs/doc_examples/d13c7cdfc976e0c7b70737cd6a7becb8.asciidoc
Normal file
37
docs/doc_examples/d13c7cdfc976e0c7b70737cd6a7becb8.asciidoc
Normal file
@ -0,0 +1,37 @@
|
||||
// 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.search({
|
||||
index: "sales",
|
||||
size: 0,
|
||||
runtime_mappings: {
|
||||
"price.adjusted": {
|
||||
type: "double",
|
||||
script: {
|
||||
source: "emit(doc['price'].value * params.adjustment)",
|
||||
params: {
|
||||
adjustment: 0.9,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
aggs: {
|
||||
by_date: {
|
||||
date_histogram: {
|
||||
field: "date",
|
||||
calendar_interval: "month",
|
||||
},
|
||||
aggs: {
|
||||
avg_price: {
|
||||
rate: {
|
||||
field: "price.adjusted",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
Reference in New Issue
Block a user