private function getMetrics($rawValue)
    {
        $metrics = [];

        foreach ($rawValue as $metricName => $value) {
            if (!is_array($value) || !isset($value['buckets'])) {
                $metricName = $metricName == 'doc_count' ? 'count' : $metricName;
                if (is_array($value) && isset($value['value_as_string'])) {
                    $value = $value['value_as_string'];
                } elseif (is_array($value) && isset($value['value'])) {
                    $value = $value['value'];
                }
                $metrics[$metricName] = $value;
            }
        }

        return $metrics;
    }
private function getMetrics($rawValue)
    {
        $metrics = [];

        foreach ($rawValue as $metricName => $value) {
            if (!is_array($value) || !isset($value['buckets'])) {
                $metricName = $metricName == 'doc_count' ? 'count' : $metricName;
                if (is_array($value) && isset($value['value_as_string'])) {
                    $value = $value['value_as_string'];
                } elseif (is_array($value) && isset($value['value'])) {
                    $value = $value['value'];
                }
                $metrics[$metricName] = $value;
            }
        }

        return $metrics;
    }
private function getMetrics ( $ rawValue ) { $ metrics = [ ] ; foreach ( $ rawValue as $ metricName => $ value ) { if ( ! is_array ( $ value ) || ! isset ( $ value [ 'buckets' ] ) ) { $ metricName = $ metricName == 'doc_count' ? 'count' : $ metricName ; if ( is_array ( $ value ) && isset ( $ value [ 'value_as_string' ] ) ) { $ value = $ value [ 'value_as_string' ] ; } elseif ( is_array ( $ value ) && isset ( $ value [ 'value' ] ) ) { $ value = $ value [ 'value' ] ; } $ metrics [ $ metricName ] = $ value ; } } return $ metrics ; }
Parse a bucket and returns metrics.

@param array $rawValue Bucket data.

@return mixed
Parse a bucket and returns metrics .