Maximum aggregations

The max metric is a single-value metric aggregations that returns the maximum value of a field.

The following example calculates the maximum of the taxful_total_price field:

  1. GET opensearch_dashboards_sample_data_ecommerce/_search
  2. {
  3. "size": 0,
  4. "aggs": {
  5. "max_taxful_total_price": {
  6. "max": {
  7. "field": "taxful_total_price"
  8. }
  9. }
  10. }
  11. }

copy

Example response

  1. {
  2. "took": 17,
  3. "timed_out": false,
  4. "_shards": {
  5. "total": 1,
  6. "successful": 1,
  7. "skipped": 0,
  8. "failed": 0
  9. },
  10. "hits": {
  11. "total": {
  12. "value": 4675,
  13. "relation": "eq"
  14. },
  15. "max_score": null,
  16. "hits": []
  17. },
  18. "aggregations": {
  19. "max_taxful_total_price": {
  20. "value": 2250
  21. }
  22. }
  23. }