You can set the size to 0. http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-from-size.html
You will still get back the search metadata though. -- Ivan On Thu, May 22, 2014 at 4:46 AM, Subhadip Bagui <i.ba...@gmail.com> wrote: > Hi, > > I want to get the average value of MEMORY field from my ES document. Below > is the query I'm using for that. Here I'm getting the aggregation along > with the hits Json also. Is there any way we can get the aggreation result > only. Please suggest. > > POST /virtualmachines/_search > { > "query" : { > "filtered" : { > "query" : { "match" : { > "CLOUD_TYPE" : "CLOUDSTACK" > }}, > "filter" : { > "range" : { "NODE_CREATE_TIME" : { "from" : "2014-05-22 > 14:11:35", "to" : "2014-05-22 14:33:35" }} > } > } > }, > "aggs" : { > "memory_avg" : { "avg" : { "field" : "MEMORY" } } > } > } > > *response* : > { > "took": 2, > "timed_out": false, > "_shards": { > "total": 3, > "successful": 3, > "failed": 0 > }, > "hits": { > "total": 1, > "max_score": 1, > "hits": [ > { > "_index": "virtualmachines", > "_type": "nodes", > "_id": "102", > "_score": 1, > "_source": { > "NODE_ID": "12235", > "CLOUD_TYPE": "CLOUDSTACK", > "NODE_GROUP_NAME": "JBOSS", > "NODE_CPU": "4GHZ", > "NODE_HOSTNAME": "cloud.aricent.com", > "NODE_NAME": "cloudstack-node1", > "NODE_PRIVATE_IP_ADDRESS": "10.123.124.125", > "NODE_PUBLIC_IP_ADDRESS": "125.31.108.72", > "NODE_INSTANCE_ID": "cloudstack112", > "NODE_STATUS": "ACTIVE", > "NODE_CATEGORY_ID": "13", > "NODE_CREATE_TIME": "2014-05-22 14:23:04", > "CPU_SPEED": "500", > "MEMORY": 512, > "CPU_USED": "0.03%" > } > } > ] > }, > "aggregations": { > "memory_avg": { > "value": 512 > } > } > } > > -- > You received this message because you are subscribed to the Google Groups > "elasticsearch" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elasticsearch+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/a8538769-7ba5-4ad5-b190-5f0b8d25a26b%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/a8538769-7ba5-4ad5-b190-5f0b8d25a26b%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCfKh_qbSiEJtj_%3DS%3DZ5Q43Lw3V4egRVEdsvz46FvvqPw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.