As title said, how to do multiplication on a field like sum function do like:
POST tsdb_alias/_search?routing=metric_name1
{
"query": {
"bool": {
"filter": [
{
"term": {
"metric": "metric_name1"
}
},
{
"term": {
"t.key1": "val1"
}
},
{
"range": {
"@timestamp": {
"gte": "2020-01-01",
"lte": "2020-01-02"
}
}
}
]
}
},
"aggs": {
"ts": {
"date_histogram": {
"field": "@timestamp",
"interval": "1h"
},
"aggs": {
"res": {
"multiplier": {
"field": "f.name1"
}
}
}
}
},
"size": 0
}
In our use case, we use es as tsdb that described in
and data we store are look like:
{
"metric": "metric_name",
"@timestamp": "2020-01-01T01:01:01",
"t": {
"key1": "val1",
"key2": "val2"
},
"f": {
"name1": 1.2,
"name2": 2.3
}
}