in src/Endpoints/Ml.php [846:865]
public function getBuckets(?array $params = null)
{
$params = $params ?? [];
$this->checkRequiredParameters(['job_id'], $params);
if (isset($params['timestamp'])) {
$url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/results/buckets/' . $this->encode($params['timestamp']);
$method = empty($params['body']) ? 'GET' : 'POST';
} else {
$url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/results/buckets';
$method = empty($params['body']) ? 'GET' : 'POST';
}
$url = $this->addQueryString($url, $params, ['expand','exclude_interim','from','size','start','end','anomaly_score','sort','desc','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
];
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
$request = $this->addOtelAttributes($params, ['job_id', 'timestamp'], $request, 'ml.get_buckets');
return $this->client->sendRequest($request);
}