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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a8538769-7ba5-4ad5-b190-5f0b8d25a26b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.