sum bucket aggregation.

@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-sum-bucket-aggregation.html

@param string      $name
@param string|null $bucketsPath

@return SumBucket
969022
public function sum_bucket(string $name, string $bucketsPath = null): SumBucket
    {
        return new SumBucket($name, $bucketsPath);
    }
278248
public function createObject($local_file_path, $file_name, $bucket = null, $namespace = null)
    {
        if (is_null($bucket) && is_null($this->bucket)) {
            $this->addMessage('Invalid bucket');
            return false;
        } else if (!is_null($this->bucket)) {
            $bucket = $this->bucket;
        }

        if (is_null($namespace) && is_null($this->namespace)) {
            $namespace = '';
        } else if (!is_null($this->namespace)) {
            $namespace = $this->namespace;
        }

        $namespace = (strlen($namespace) == 0) ? '' : $namespace . '/';

        if (!$this->doesBucketExist($bucket)) {
            $this->addMessage('Bucket does not exist');
            return false;
        }

        $s3_file_path = "s3://$bucket/$namespace$file_name";

        if (copy($local_file_path, $s3_file_path)) {
            return $file_name;
        } else {
            $this->addMessage("Could not upload file from $local_file_path to $s3_file_path");
            return false;
        }
    }
666865
public function getAggregation($name)
    {
        $aggregations = parent::getAggregations();
        if (!array_key_exists($name, $aggregations)) {
            return null;
        }

        return new AggregationValue($aggregations[$name]);
    }
440292
public static function delFile($bucketName, $path) {
		$path = self::normalizerPath($path);

        return self::delBase($bucketName, $path);
    }
1363607
public function updateBucket($name, array $options = [])
    {
        $buckets = $this->cbClusterManager->listBuckets();
        $bucketInfo = array_by_key_value($buckets, 'name', $name);
        $url = 'http://' . $this->host . array_get($bucketInfo, 'uri');
        $curlOptions = [
            CURLOPT_URL            => $url,
            CURLOPT_PORT           => $this->port,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_VERBOSE        => false,
            CURLOPT_POST           => true,
            CURLOPT_POSTFIELDS     => json_encode($options),
            CURLOPT_HTTPAUTH       => CURLAUTH_BASIC,
            CURLOPT_USERPWD        => $this->username . ":" . $this->password
        ];

        $ch = curl_init();
        curl_setopt_array($ch, $curlOptions);
        curl_exec($ch);
        $rs = curl_getinfo($ch);

        if (200 !== $code = array_get($rs, 'http_code')) {
            throw new InternalServerErrorException('Bucket update failed. Request received response code [' .
                $code .
                ']');
        }

        return true;
    }
1327998
protected function refreshPermissions(BucketInterface $bucket, string $name): bool
    {
        if (!function_exists('ssh2_sftp_chmod')) {
            return true;
        }

        return ssh2_sftp_chmod(
            $this->conn,
            $this->castPath($bucket, $name),
            $bucket->getOption('mode', FilesInterface::RUNTIME)
        );
    }
859197
protected function _mkdir($path, $name) {
		
		$newkey = $this->_normpath($path);
		$newkey = preg_replace("/\/$/", "", $newkey);
		$newkey = "$newkey/$name/";

		try {
			$obj = $this->s3->PutObjectInline(array('Bucket' => $this->options['bucket'], 'Key' => $newkey , 'ContentLength' => 0, 'Data' => ''));
		} catch (Exception $e) {
		
		}
		
		if (isset($obj)) {
			return "$path/$name";
		}
		
		return false;
	}
724018
public function getAggregation($name)
    {
        $data = $this->_response->getData();

        if (isset($data['aggregations']) && isset($data['aggregations'][$name])) {
            return $data['aggregations'][$name];
        }
        throw new InvalidException("This result set does not contain an aggregation named {$name}.");
    }
173133
public static function appSign_once($path, $bucketName)
    {
        $appId = Conf::getAppId();
        $secretId = Conf::getSecretId();
        $secretKey = Conf::getSecretKey();

        if (preg_match('/^\//', $path) == 0) {
            $path = '/'.$path;
        }
        $fileId = '/'.$appId.'/'.$bucketName.$path;

        if (empty($secretId) || empty($secretKey) || empty($appId)) {
            return self::AUTH_SECRET_ID_KEY_ERROR;
        }

        return self::appSignBase($appId, $secretId, $secretKey, 0, $fileId, $bucketName);
    }
347275
public function buildBucket(BucketInterface $bucket)
    {
        if ($bucket->getType() !== BucketInterface::TYPE_SIGNIFICANT_TERM) {
            throw new \InvalidArgumentException("Query builder : invalid aggregation type {$bucket->getType()}.");
        }
        $aggrepationParams = [
            'field'                 => $bucket->getField(),
            'size'                  => $bucket->getSize(),
            'min_doc_count'         => $bucket->getMinDocCount(),
            $bucket->getAlgorithm() => new \stdClass(),
        ];

        return ['significant_terms' => $aggrepationParams];
    }
590892
protected function getPath(BucketInterface $bucket, string $name): string
    {
        return $this->files->normalizePath(
            $this->options['home'] . '/' . $bucket->getOption('directory') . $name
        );
    }
105434
public function openBucket(string $name): Bucket
    {
        $couchbase = $this->getCouchbase();
        if ($this->bucketPassword === '') {
            return $couchbase->openBucket($name);
        }

        return $couchbase->openBucket($name, $this->bucketPassword);
    }
588997
private Bucket getCachedBucket(final String name) {
        Bucket cachedBucket = bucketCache.get(name);

        if(cachedBucket != null) {
            if (cachedBucket.isClosed()) {
                LOGGER.debug("Not returning cached bucket \"{}\", because it is closed.", name);
                bucketCache.remove(name);
            } else {
                LOGGER.debug("Returning still open, cached bucket \"{}\"", name);
                return cachedBucket;
            }
        }

        return null;
    }
729266
public function object_exists( $name ) {
		
		$this->object = $this->bucket->object( $name );
		return $this->object->exists();
		
	}
1090023
func (a *SumBucketAggregation) BucketsPath(bucketsPaths ...string) *SumBucketAggregation {
	a.bucketsPaths = append(a.bucketsPaths, bucketsPaths...)
	return a
}
401829
public function getBucket(string $name): array
    {
        if (!$this->hasBucket($name)) {
            throw new ConfigException("Undefined bucket `{$name}`");
        }

        $bucket = $this->config['buckets'][$name];

        if (!array_key_exists('options', $bucket)) {
            throw new ConfigException("Bucket `{$name}` must specify `options`");
        }

        if (!array_key_exists('prefix', $bucket)) {
            throw new ConfigException("Bucket `{$name}` must specify `prefix`");
        }

        if (!array_key_exists('server', $bucket)) {
            throw new ConfigException("Bucket `{$name}` must specify `server` name.");
        }

        return $bucket;
    }
53795
public function counting($name, $hit, $total = null)
    {
        if (!is_string($name) || empty($name)) {
            return;
        }
        if (!isset($this->_countings[$name])) {
            $this->_countings[$name] = ['hit' => 0, 'total' => 0];
        }
        $this->_countings[$name]['hit'] += intval($hit);
        if ($total !== null) {
            $this->_countings[$name]['total'] += intval($total);
        }
    }