checkRequiredParameters(['id'], $params); $url = '/_rollup/job/' . $this->encode($params['id']); $method = 'DELETE'; $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); } /** * Retrieves the configuration, stats, and status of rollup jobs. * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-job.html * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ * id: string, // The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) * human: boolean, // Return human readable values for statistics. (DEFAULT: true) * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. * filter_path: list, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline * @throws ClientResponseException if the status code of response is 4xx * @throws ServerResponseException if the status code of response is 5xx * * @return Elasticsearch|Promise */ public function getJobs(array $params = []) { if (isset($params['id'])) { $url = '/_rollup/job/' . $this->encode($params['id']); $method = 'GET'; } else { $url = '/_rollup/job/'; $method = 'GET'; } $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); } /** * Returns the capabilities of any rollup jobs that have been configured for a specific index or index pattern. * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-rollup-caps.html * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ * id: string, // The ID of the index to check rollup capabilities on, or left blank for all jobs * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) * human: boolean, // Return human readable values for statistics. (DEFAULT: true) * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. * filter_path: list, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline * @throws ClientResponseException if the status code of response is 4xx * @throws ServerResponseException if the status code of response is 5xx * * @return Elasticsearch|Promise */ public function getRollupCaps(array $params = []) { if (isset($params['id'])) { $url = '/_rollup/data/' . $this->encode($params['id']); $method = 'GET'; } else { $url = '/_rollup/data/'; $method = 'GET'; } $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); } /** * Returns the rollup capabilities of all jobs inside of a rollup index (e.g. the index where rollup data is stored). * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-rollup-index-caps.html * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ * index: string, // (REQUIRED) The rollup index or index pattern to obtain rollup capabilities from. * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) * human: boolean, // Return human readable values for statistics. (DEFAULT: true) * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. * filter_path: list, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing * @throws NoNodeAvailableException if all the hosts are offline * @throws ClientResponseException if the status code of response is 4xx * @throws ServerResponseException if the status code of response is 5xx * * @return Elasticsearch|Promise */ public function getRollupIndexCaps(array $params = []) { $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_rollup/data'; $method = 'GET'; $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); } /** * Creates a rollup job. * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-put-job.html * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ * id: string, // (REQUIRED) The ID of the job to create * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) * human: boolean, // Return human readable values for statistics. (DEFAULT: true) * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. * filter_path: list, // A comma-separated list of filters used to reduce the response. * body: array, // (REQUIRED) The job configuration * } $params * * @throws MissingParameterException if a required parameter is missing * @throws NoNodeAvailableException if all the hosts are offline * @throws ClientResponseException if the status code of response is 4xx * @throws ServerResponseException if the status code of response is 5xx * * @return Elasticsearch|Promise */ public function putJob(array $params = []) { $this->checkRequiredParameters(['id','body'], $params); $url = '/_rollup/job/' . $this->encode($params['id']); $method = 'PUT'; $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', ]; return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); } /** * Enables searching rolled-up data using the standard query DSL. * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-search.html * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ * index: list, // (REQUIRED) The indices or index-pattern(s) (containing rollup or regular data) that should be searched * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) * human: boolean, // Return human readable values for statistics. (DEFAULT: true) * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. * filter_path: list, // A comma-separated list of filters used to reduce the response. * body: array, // (REQUIRED) The search request body * } $params * * @throws MissingParameterException if a required parameter is missing * @throws NoNodeAvailableException if all the hosts are offline * @throws ClientResponseException if the status code of response is 4xx * @throws ServerResponseException if the status code of response is 5xx * * @return Elasticsearch|Promise */ public function rollupSearch(array $params = []) { $this->checkRequiredParameters(['index','body'], $params); $url = '/' . $this->encode($params['index']) . '/_rollup_search'; $method = empty($params['body']) ? 'GET' : 'POST'; $url = $this->addQueryString($url, $params, ['typed_keys','rest_total_hits_as_int','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', ]; return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); } /** * Starts an existing, stopped rollup job. * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-start-job.html * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ * id: string, // (REQUIRED) The ID of the job to start * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) * human: boolean, // Return human readable values for statistics. (DEFAULT: true) * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. * filter_path: list, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing * @throws NoNodeAvailableException if all the hosts are offline * @throws ClientResponseException if the status code of response is 4xx * @throws ServerResponseException if the status code of response is 5xx * * @return Elasticsearch|Promise */ public function startJob(array $params = []) { $this->checkRequiredParameters(['id'], $params); $url = '/_rollup/job/' . $this->encode($params['id']) . '/_start'; $method = 'POST'; $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); } /** * Stops an existing, started rollup job. * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-stop-job.html * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ * id: string, // (REQUIRED) The ID of the job to stop * wait_for_completion: boolean, // True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false. * timeout: time, // Block for (at maximum) the specified duration while waiting for the job to stop. Defaults to 30s. * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) * human: boolean, // Return human readable values for statistics. (DEFAULT: true) * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. * filter_path: list, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing * @throws NoNodeAvailableException if all the hosts are offline * @throws ClientResponseException if the status code of response is 4xx * @throws ServerResponseException if the status code of response is 5xx * * @return Elasticsearch|Promise */ public function stopJob(array $params = []) { $this->checkRequiredParameters(['id'], $params); $url = '/_rollup/job/' . $this->encode($params['id']) . '/_stop'; $method = 'POST'; $url = $this->addQueryString($url, $params, ['wait_for_completion','timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); } }