Elasticsearch 9 · Searching

Aggregate

Compute the average price without returning documents.

curl -u elastic:$ELASTIC_PASSWORD --cacert http_ca.crt "https://localhost:9200/products/_search?pretty" -H "Content-Type: application/json" -d '{"size":0,"aggs":{"avg_price":{"avg":{"field":"price"}}}}'

Official Elasticsearch 9 documentation

More searching commands

All searching commands · Elasticsearch 9 cheatsheet

Was this page helpful?