mirror of
https://github.com/iSharkFly-Docs/opensearch-docs-cn
synced 2025-02-07 15:28:10 +00:00
a87fdc0f63
* Add analyzer documentation Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Add index and search analyzer pages Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Doc review comments Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Apply suggestions from code review Co-authored-by: Melissa Vagi <vagimeli@amazon.com> Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> * More doc review comments Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Apply suggestions from code review Co-authored-by: Nathan Bower <nbower@amazon.com> Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> * Implemented editorial comments Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Update index-analyzers.md Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> --------- Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Co-authored-by: Melissa Vagi <vagimeli@amazon.com> Co-authored-by: Nathan Bower <nbower@amazon.com>
59 lines
977 B
Markdown
59 lines
977 B
Markdown
---
|
|
layout: default
|
|
title: Sum
|
|
parent: Metric aggregations
|
|
grand_parent: Aggregations
|
|
nav_order: 120
|
|
redirect_from:
|
|
- /query-dsl/aggregations/metric/sum/
|
|
---
|
|
|
|
# Sum aggregations
|
|
|
|
The `sum` metric is a single-value metric aggregations that returns the sum of the values of a field.
|
|
|
|
The following example calculates the total sum of the `taxful_total_price` field:
|
|
|
|
```json
|
|
GET opensearch_dashboards_sample_data_ecommerce/_search
|
|
{
|
|
"size": 0,
|
|
"aggs": {
|
|
"sum_taxful_total_price": {
|
|
"sum": {
|
|
"field": "taxful_total_price"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
{% include copy-curl.html %}
|
|
|
|
#### Example response
|
|
|
|
```json
|
|
{
|
|
"took": 16,
|
|
"timed_out": false,
|
|
"_shards": {
|
|
"total": 1,
|
|
"successful": 1,
|
|
"skipped": 0,
|
|
"failed": 0
|
|
},
|
|
"hits": {
|
|
"total": {
|
|
"value": 4675,
|
|
"relation": "eq"
|
|
},
|
|
"max_score": null,
|
|
"hits": []
|
|
},
|
|
"aggregations": {
|
|
"sum_taxful_total_price": {
|
|
"value": 350884.12890625
|
|
}
|
|
}
|
|
}
|
|
```
|