I have what will be a long running time series table that I would like to
aggregate by time buckets and analyze:
- Query & Filter (in this case by dates & a term query on user_guid)
(Working) - Bucket by time for analysis (working using the aggs "date_aggregate"
and "heartRate_stats" aggs - Perform range counts on the metrics produced by the metrics within
the buckets. *Not working. *The "heartRate_zoneCounts1" aggregator gets
zero counts - seems you can't point from the top down. The
"heartRate_zoneCounts" aggregator does counts of the individual documents
within the bucket (nice - but not what I'm looking for).
So how would I apply a range aggregate to the outcome of the
heartRate_stats metric and get only one value per date_aggregate bucket? I
can post process the results to apply a range but would rather have ES do
it for me. Any / all help apprecuated. Thanks in advance!
--Mike
The Results
mikeasick https://gist.github.com/mikeasick /
gist:8734325https://gist.github.com/mikeasick/8734325
The Data (per second stream of the information below)
mikeasick https://gist.github.com/mikeasick / gist:8734404
https://gist.github.com/mikeasick/8734404
The Search
curl -XGET "http://localhost:9200/vitals/vital/_search?pretty=true" -d'
{
"size": 0,
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": {
"filters": [
{
"term": {"user_guid": "0ad08904-c1cf-46cf-9a04-e0865c1cced2"}
},
{
"numeric_range": {
"recorded_time": {
"gte": "2013-01-05T04:44:33.396-05:00",
"lte": "2014-01-05T04:44:33.396-05:00"
}
}
}
]
}
}
}
},
"aggs": {
"date_aggregate": {
"date_histogram": {
"field": "recorded_time",
"interval": "5m"
},
"aggs": {
"heartRate_zoneAverageCounts": {
"range" : {
"field" : "heartRate_stats.avg",
"ranges" : [
{ "to" : 50 },
{ "from" : 50, "to" : 100 },
{ "from" : 100 }
]
}
},
"heartRate_zoneCounts": {
"range" : {
"field" : "heartRate",
"ranges" : [
{ "to" : 50 },
{ "from" : 50, "to" : 100 },
{ "from" : 100 }
]
}
},
"heartRate_stats": {
"extended_stats": {
"field": "heartRate"
}
}
}
}
}
}'
--
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/CAP8axnB_ysa7DMMnsxou%2BJoaPe7kzT3CooLrn_oYi1petadF8A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.