36

Im using ES 1.4. When I perform an aggregation, the result returns the hits array as well. Is there a way to only return the aggregations?

2 Answers 2

62

You would have to specify in the query that the size is equal to 0

ex :

{ 
    "query": ... ,
    "aggs": ... ,
    "size": 0
}

You can find the related documentation here.

Sign up to request clarification or add additional context in comments.

Comments

12

It is possible. You should type additional Parameter (?search_type=count) in your Url. Have a look here: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations.html#_returning_only_aggregation_results

1 Comment

The new documentation link is here: elastic.co/guide/en/elasticsearch/reference/current/… And it recommends the "size": 0 approach

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.