Alguém poderia compartilhar como aplicar uma divisão acumulada sobre a soma de fields?
Exemplo:
Ou seja, sempre preciso somar para depois dividir.
Grato,
Edmar
Alguém poderia compartilhar como aplicar uma divisão acumulada sobre a soma de fields?
Exemplo:
Ou seja, sempre preciso somar para depois dividir.
Grato,
Edmar
I don't speak Portuguese (sorry)! But maybe you can use Google translate as I did to understand your question?
Basically, you can use a pipeline aggregator:
They're available in Kibana in the Time Series Visual Builder. Here's an example of how you can do it directly (in the Kibana Dev Tools console, for example):
PUT myjobs/docs/1
{
"field1": 44,
"field2": 5
}
PUT myjobs/docs/2
{
"field1": 22,
"field2": 4
}
GET myjobs/_search
{
"size": 0,
"aggs": {
"inelegant": {
"terms": {
"script": "'anything'"
},
"aggs": {
"sum_field1": {
"sum": {
"field": "field1"
}
},
"sum_field2": {
"sum": {
"field": "field2"
}
},
"div_secs": {
"bucket_script": {
"buckets_path": {
"sum_field1": "sum_field1",
"sum_field2": "sum_field2"
},
"script": "params.sum_field1 / params.sum_field2"
}
}
}
}
}
}
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.