原文地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/returning-only-agg-results.html, 原文档版权归 www.elastic.co 所有
IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Returning only aggregation resultsedit
There are many occasions when aggregations are required but search hits are not. For these cases the hits can be ignored by
setting size=0
. For example:
GET /twitter/_search { "size": 0, "aggregations": { "my_agg": { "terms": { "field": "text" } } } }
Setting size
to 0
avoids executing the fetch phase of the search making the request more efficient.