Hello !
I have doc for each of my product.
My product have serviceCreationDate and serviceTerminationDate field.
i try to have the diff between service created and terminated. However i dont find a solution with Kibana.
Exemple ES request working :
{
"aggs": {
"4": {
"date_histogram": {
"field": "serviceCreationDate",
"interval": "1w",
"time_zone": "Europe/Berlin",
"min_doc_count": 0
},
"aggs": {
"test": {
"bucket_script": {
"buckets_path": {
"terminated": "7",
"activated": "6"
},
"script": "params.activated - params.terminated"
}
},
"6": {
"cumulative_sum": {
"buckets_path": "6-metric"
}
},
"7": {
"cumulative_sum": {
"buckets_path": "7-metric"
}
},
"7-metric": {
"sum_bucket": {
"buckets_path": "7-metric-bucket>_count"
}
},
"7-metric-bucket": {
"date_histogram": {
"field": "serviceTerminationDate",
"interval": "1w",
"time_zone": "Europe/Berlin",
"min_doc_count": 1
}
},
"6-metric": {
"sum_bucket": {
"buckets_path": "6-metric-bucket>_count"
}
},
"6-metric-bucket": {
"date_histogram": {
"field": "serviceCreationDate",
"interval": "1w",
"time_zone": "Europe/Berlin",
"min_doc_count": 1
}
}
}
}
},
"size": 0,
"_source": {
"excludes": []
},
"stored_fields": [
"*"
],
"script_fields": {},
"docvalue_fields": [
{
"field": "serviceCreationDate",
"format": "date_time"
},
{
"field": "serviceTerminationDate",
"format": "date_time"
}
],
"query": {
"bool": {
"must": [
{
"match_all": {}
},
{
"match_all": {}
},
{
"range": {
"serviceCreationDate": {
"gte": 1484734919956,
"lte": 1642501319956,
"format": "epoch_millis"
}
}
}
],
"filter": [],
"should": [],
"must_not": []
}
}
}
}
This give we the result i want
However, i dont find any solution to add the "test" part with kibana ( 6.8.23 )
Do you have some suggestion ?
Best regards.