Hello,
I'm kind of new to ES. I'm searching for the possibilities to do some high level aggregation with ES.
I want to know if I could do this on ES :
AVG ( Bucket X ) - AVG ( Bucket Y)
----------------------------------------------------------
STDEV( Bucket Y)
I have tried some queries , but the problem is with the division and how can I store the STDEV to apply Ratio filter on.
this is what I did:
GET /index/_search
{
"size": 0,
"aggs": {
"date-ranges": {
"date_range": {
"field": "publishDate",
"format": "yyyy-MM-dd",
"ranges": [
{
"from": "now-61d/d",
"to": "now-1d/d",
"key": "count_for_60d"
}
]
},
"aggs": {
"STDEV_60": {
"extended_stats": {
"field": "Pol"
}
},
"AVG_Polarity_60": {
"avg": {
"field": "Pol"
}
}
}
},
"count_for_1d": {
"filter": {
"range": {
"publishDate": {
"gte": "now-1d/d",
"lte": "now"
}
}
},
"aggs": {
"count_1d": {
"avg": {
"field": "Pol"
}
}
}
}
}
}
Any tips will be appreciated .. Thanks a lot