Skip to content

elastic.NewSumAggregation().Field() returns wrong float response #84267

Open
@ghost

Description

Elasticsearch Version

7.8.31

Installed Plugins

No response

Java Version

bundled

OS Version

21.2.0 Darwin Kernel Version 21.2.0

Problem Description

Hi! We created (/w @emre06ylmz) a customized service-detail & adaptation metrics API written in Go, we used Elasticsearch version 7.8.31 in this package. In our API, first, we created our adaptation metrics query objects, after that successfully structured querying methods, but when we wanted to get response of our customized value "field": "workload.resourceInfo.current.cpu.requestMilliValue" with NewSumAggregation response returns 0.0 value. However, the real value should have returned 175000 as we can get from Kibana UI.

Steps to Reproduce

We use this query to generate:

query = query.Aggregation(adaptationMetric.Name, elastic.NewSumAggregation().Field(adaptationMetric.IndexPath))

Our replicated query:

GET X-applications/_search
{
  "size": 0,
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "tribe.keyword": "discovery"
          }
        },
        {
          "term": {
            "environment.keyword": "prod"
          }
        }
      ]
    }
  },
  "aggs": {
    "requestMilliValue": {
      "sum": {
        "field": "workload.resourceInfo.current.cpu.requestMilliValue" // This gets total value of CPU usage as a float
      }
    },
    "argoAdaption": {
      "terms": {
        "field": "platformTools.argoCD.enabled",
        "size": 10000
      }
    }
  }
}

Logs (if relevant)

Response:

took":9,"hits":{"total":{"value":2258,"relation":"eq"}},"aggregations":{"cpuLimitMilliValue":{"value":0.0},"dynamicSecretAdaptation":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]},"cpuRequestMilliValue":{"value":0.0},"service2ServiceAuthAdaptation":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]},"argoCDAdaption":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]},"soxEnabled":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[{"key":1,"key_as_string":"true","doc_count":1184},{"key":0,"key_as_string":"false","doc_count":1074}]},"istioAdaptation":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[{"key":1,"key_as_string":"true","doc_count":2170},{"key":0,"key_as_string":"false","doc_count":88}]},"sideCacheAdaptation":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[{"key":0,"key_as_string":"false","doc_count":1689},{"key":1,"key_as_string":"true","doc_count":569}]},"registryCleanUpPolicy":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[{"key":1,"key_as_string":"true","doc_count":1627},{"key":0,"key_as_string":"false","doc_count":631}]},"rateLimitAdaptation":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]},"dynamicConfigAdaptation":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]}},"_shards":{"total":1,"successful":1,"failed":0}}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions