Files
elasticsearch-js/docs/doc_examples/3082ae0c3ecdc61808103214631b40c6.asciidoc
2024-07-29 17:10:05 -05:00

33 lines
643 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.search({
size: 0,
aggs: {
sales_per_month: {
date_histogram: {
field: "date",
calendar_interval: "month",
},
aggs: {
sales: {
sum: {
field: "price",
},
},
},
},
avg_monthly_sales: {
avg_bucket: {
buckets_path: "sales_per_month>sales",
gap_policy: "skip",
format: "#,##0.00;(#,##0.00)",
},
},
},
});
console.log(response);
----