# 3.6.6.仅返回需要聚合的结果(Returning only aggregation results)

有许多场合需要聚合，但搜索匹配不需要。对于这些情况，可以通过设置size = 0来忽略掉。例如：

```
curl -XGET 'localhost:9200/twitter/tweet/_search?pretty' -H 'Content-Type: application/json' -d'
{
  "size": 0,
  "aggregations": {
    "my_agg": {
      "terms": {
        "field": "text"
      }
    }
  }
}
'
```

将大小设置为0避免执行搜索的提取阶段，从而使请求更有效率。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xiaoxiami.gitbook.io/elasticsearch/ji-chu/36aggregationsju-he-fen-679029/366jin-fan-hui-xu-yao-ju-he-de-jie-679c28-returning-only-aggregation-results.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
