diff --git a/src/Client.php b/src/Client.php index 148135a9c..50e7dcf72 100644 --- a/src/Client.php +++ b/src/Client.php @@ -28,7 +28,7 @@ final class Client implements ClientInterface { const CLIENT_NAME = 'es'; - const VERSION = '8.13.0'; + const VERSION = '8.14.0'; const API_COMPATIBILITY_HEADER = '%s/vnd.elasticsearch+%s; compatible-with=8'; use ClientEndpointsTrait; diff --git a/src/Endpoints/Ccr.php b/src/Endpoints/Ccr.php index 454df7b4b..81bca3bc2 100644 --- a/src/Endpoints/Ccr.php +++ b/src/Endpoints/Ccr.php @@ -35,6 +35,7 @@ class Ccr extends AbstractEndpoint * * @param array{ * name: string, // (REQUIRED) The name of the auto follow pattern. + * master_timeout: time, // Explicit operation timeout for connection to master node * 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) @@ -55,7 +56,7 @@ public function deleteAutoFollowPattern(array $params = []) $url = '/_ccr/auto_follow/' . $this->encode($params['name']); $method = 'DELETE'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -71,6 +72,7 @@ public function deleteAutoFollowPattern(array $params = []) * @param array{ * index: string, // (REQUIRED) The name of the follower index * wait_for_active_shards: string, // Sets the number of shard copies that must be active before returning. Defaults to 0. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * master_timeout: time, // Explicit operation timeout for connection to master node * 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) @@ -92,7 +94,7 @@ public function follow(array $params = []) $url = '/' . $this->encode($params['index']) . '/_ccr/follow'; $method = 'PUT'; - $url = $this->addQueryString($url, $params, ['wait_for_active_shards','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['wait_for_active_shards','master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', @@ -108,6 +110,7 @@ public function follow(array $params = []) * * @param array{ * index: list, // (REQUIRED) A comma-separated list of index patterns; use `_all` to perform the operation on all indices + * master_timeout: time, // Explicit operation timeout for connection to master node * 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) @@ -128,7 +131,7 @@ public function followInfo(array $params = []) $url = '/' . $this->encode($params['index']) . '/_ccr/info'; $method = 'GET'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -143,6 +146,7 @@ public function followInfo(array $params = []) * * @param array{ * index: list, // (REQUIRED) A comma-separated list of index patterns; use `_all` to perform the operation on all indices + * timeout: time, // Explicit operation timeout * 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) @@ -163,7 +167,7 @@ public function followStats(array $params = []) $url = '/' . $this->encode($params['index']) . '/_ccr/stats'; $method = 'GET'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -178,6 +182,7 @@ public function followStats(array $params = []) * * @param array{ * index: string, // (REQUIRED) the name of the leader index for which specified follower retention leases should be removed + * timeout: time, // Explicit operation timeout * 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) @@ -199,7 +204,7 @@ public function forgetFollower(array $params = []) $url = '/' . $this->encode($params['index']) . '/_ccr/forget_follower'; $method = 'POST'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', @@ -215,6 +220,7 @@ public function forgetFollower(array $params = []) * * @param array{ * name: string, // The name of the auto follow pattern. + * master_timeout: time, // Explicit operation timeout for connection to master node * 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) @@ -237,7 +243,7 @@ public function getAutoFollowPattern(array $params = []) $url = '/_ccr/auto_follow'; $method = 'GET'; } - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -252,6 +258,7 @@ public function getAutoFollowPattern(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the auto follow pattern that should pause discovering new indices to follow. + * master_timeout: time, // Explicit operation timeout for connection to master node * 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) @@ -272,7 +279,7 @@ public function pauseAutoFollowPattern(array $params = []) $url = '/_ccr/auto_follow/' . $this->encode($params['name']) . '/pause'; $method = 'POST'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -287,6 +294,7 @@ public function pauseAutoFollowPattern(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the follower index that should pause following its leader index. + * master_timeout: time, // Explicit operation timeout for connection to master node * 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) @@ -307,7 +315,7 @@ public function pauseFollow(array $params = []) $url = '/' . $this->encode($params['index']) . '/_ccr/pause_follow'; $method = 'POST'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -322,6 +330,7 @@ public function pauseFollow(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the auto follow pattern. + * master_timeout: time, // Explicit operation timeout for connection to master node * 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) @@ -343,7 +352,7 @@ public function putAutoFollowPattern(array $params = []) $url = '/_ccr/auto_follow/' . $this->encode($params['name']); $method = 'PUT'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', @@ -359,6 +368,7 @@ public function putAutoFollowPattern(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the auto follow pattern to resume discovering new indices to follow. + * master_timeout: time, // Explicit operation timeout for connection to master node * 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) @@ -379,7 +389,7 @@ public function resumeAutoFollowPattern(array $params = []) $url = '/_ccr/auto_follow/' . $this->encode($params['name']) . '/resume'; $method = 'POST'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -394,6 +404,7 @@ public function resumeAutoFollowPattern(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the follow index to resume following. + * master_timeout: time, // Explicit operation timeout for connection to master node * 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) @@ -415,7 +426,7 @@ public function resumeFollow(array $params = []) $url = '/' . $this->encode($params['index']) . '/_ccr/resume_follow'; $method = 'POST'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', @@ -430,6 +441,8 @@ public function resumeFollow(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html * * @param array{ + * timeout: time, // Explicit operation timeout + * master_timeout: time, // Explicit operation timeout for connection to master node * 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) @@ -448,7 +461,7 @@ public function stats(array $params = []) $url = '/_ccr/stats'; $method = 'GET'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['timeout','master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -463,6 +476,7 @@ public function stats(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the follower index that should be turned into a regular index. + * master_timeout: time, // Explicit operation timeout for connection to master node * 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) @@ -483,7 +497,7 @@ public function unfollow(array $params = []) $url = '/' . $this->encode($params['index']) . '/_ccr/unfollow'; $method = 'POST'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; diff --git a/src/Endpoints/Connector.php b/src/Endpoints/Connector.php index e7cc61b7e..306461cd9 100644 --- a/src/Endpoints/Connector.php +++ b/src/Endpoints/Connector.php @@ -72,6 +72,7 @@ public function checkIn(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be deleted. + * delete_sync_jobs: boolean, // Determines whether associated sync jobs are also deleted. * 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) @@ -92,7 +93,7 @@ public function delete(array $params = []) $url = '/_connector/' . $this->encode($params['connector_id']); $method = 'DELETE'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['delete_sync_jobs','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -287,6 +288,337 @@ public function put(array $params = []) } + /** + * Cancels a connector sync job. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cancel-connector-sync-job-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be canceled + * 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 syncJobCancel(array $params = []) + { + $this->checkRequiredParameters(['connector_sync_job_id'], $params); + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_cancel'; + $method = 'PUT'; + + $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)); + } + + + /** + * Checks in a connector sync job (refreshes 'last_seen'). + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/check-in-connector-sync-job-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be checked in + * 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 syncJobCheckIn(array $params = []) + { + $this->checkRequiredParameters(['connector_sync_job_id'], $params); + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_check_in'; + $method = 'PUT'; + + $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)); + } + + + /** + * Deletes a connector sync job. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-sync-job-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be deleted. + * 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 syncJobDelete(array $params = []) + { + $this->checkRequiredParameters(['connector_sync_job_id'], $params); + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_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)); + } + + + /** + * Sets an error for a connector sync job. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-error-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to set an error for. + * 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 error to set in the connector sync job. + * } $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 syncJobError(array $params = []) + { + $this->checkRequiredParameters(['connector_sync_job_id','body'], $params); + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_error'; + $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)); + } + + + /** + * Returns the details about a connector sync job. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-connector-sync-job-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be returned. + * 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 syncJobGet(array $params = []) + { + $this->checkRequiredParameters(['connector_sync_job_id'], $params); + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']); + $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)); + } + + + /** + * Lists all connector sync jobs. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-connector-sync-jobs-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * from: int, // Starting offset (default: 0) + * size: int, // specifies a max number of results to get (default: 100) + * status: string, // Sync job status, which sync jobs are fetched for + * connector_id: string, // Id of the connector to fetch the sync jobs for + * job_type: list, // A comma-separated list of job types + * 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 syncJobList(array $params = []) + { + $url = '/_connector/_sync_job'; + $method = 'GET'; + + $url = $this->addQueryString($url, $params, ['from','size','status','connector_id','job_type','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 connector sync job. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-sync-job-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * 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 connector sync job data. + * } $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 syncJobPost(array $params = []) + { + $this->checkRequiredParameters(['body'], $params); + $url = '/_connector/_sync_job'; + $method = 'POST'; + + $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)); + } + + + /** + * Updates the stats fields in the connector sync job document. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-stats-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be updated. + * 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 stats to update for the connector sync job. + * } $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 syncJobUpdateStats(array $params = []) + { + $this->checkRequiredParameters(['connector_sync_job_id','body'], $params); + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_stats'; + $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)); + } + + + /** + * Activates the draft filtering rules if they are in a validated state. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. + * 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 updateActiveFiltering(array $params = []) + { + $this->checkRequiredParameters(['connector_id'], $params); + $url = '/_connector/' . $this->encode($params['connector_id']) . '/_filtering/_activate'; + $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)); + } + + /** * Updates the API key id and/or API key secret id fields in the connector document. * @@ -439,6 +771,44 @@ public function updateFiltering(array $params = []) } + /** + * Updates the validation info of the draft filtering rules. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. + * 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) Validation info for the draft filtering rules + * } $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 updateFilteringValidation(array $params = []) + { + $this->checkRequiredParameters(['connector_id','body'], $params); + $url = '/_connector/' . $this->encode($params['connector_id']) . '/_filtering/_validation'; + $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)); + } + + /** * Updates the index name of the connector. * diff --git a/src/Endpoints/ConnectorSyncJob.php b/src/Endpoints/ConnectorSyncJob.php deleted file mode 100644 index b46cf9ecf..000000000 --- a/src/Endpoints/ConnectorSyncJob.php +++ /dev/null @@ -1,323 +0,0 @@ -checkRequiredParameters(['connector_sync_job_id'], $params); - $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_cancel'; - $method = 'PUT'; - - $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)); - } - - - /** - * Checks in a connector sync job (refreshes 'last_seen'). - * - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/check-in-connector-sync-job-api.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release - * - * @param array{ - * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be checked in - * 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 checkIn(array $params = []) - { - $this->checkRequiredParameters(['connector_sync_job_id'], $params); - $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_check_in'; - $method = 'PUT'; - - $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)); - } - - - /** - * Deletes a connector sync job. - * - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-sync-job-api.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release - * - * @param array{ - * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be deleted. - * 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 delete(array $params = []) - { - $this->checkRequiredParameters(['connector_sync_job_id'], $params); - $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_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)); - } - - - /** - * Sets an error for a connector sync job. - * - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-error-api.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release - * - * @param array{ - * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to set an error for. - * 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 error to set in the connector sync job. - * } $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 error(array $params = []) - { - $this->checkRequiredParameters(['connector_sync_job_id','body'], $params); - $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_error'; - $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)); - } - - - /** - * Returns the details about a connector sync job. - * - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-connector-sync-job-api.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release - * - * @param array{ - * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be returned. - * 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 get(array $params = []) - { - $this->checkRequiredParameters(['connector_sync_job_id'], $params); - $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']); - $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)); - } - - - /** - * Lists all connector sync jobs. - * - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-connector-sync-jobs-api.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release - * - * @param array{ - * from: int, // Starting offset (default: 0) - * size: int, // specifies a max number of results to get (default: 100) - * status: string, // Sync job status, which sync jobs are fetched for - * connector_id: string, // Id of the connector to fetch the sync jobs for - * job_type: list, // A comma-separated list of job types - * 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 list(array $params = []) - { - $url = '/_connector/_sync_job'; - $method = 'GET'; - - $url = $this->addQueryString($url, $params, ['from','size','status','connector_id','job_type','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 connector sync job. - * - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-sync-job-api.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release - * - * @param array{ - * 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 connector sync job data. - * } $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 post(array $params = []) - { - $this->checkRequiredParameters(['body'], $params); - $url = '/_connector/_sync_job'; - $method = 'POST'; - - $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)); - } - - - /** - * Updates the stats fields in the connector sync job document. - * - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-stats-api.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release - * - * @param array{ - * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be updated. - * 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 stats to update for the connector sync job. - * } $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 updateStats(array $params = []) - { - $this->checkRequiredParameters(['connector_sync_job_id','body'], $params); - $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_stats'; - $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)); - } -} diff --git a/src/Endpoints/Esql.php b/src/Endpoints/Esql.php index 19ddac353..1c07eb4d8 100644 --- a/src/Endpoints/Esql.php +++ b/src/Endpoints/Esql.php @@ -32,7 +32,6 @@ class Esql extends AbstractEndpoint * Executes an ESQL request asynchronously * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-api.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ * format: string, // a short version of the Accept header, e.g. json, yaml @@ -109,7 +108,6 @@ public function asyncQueryGet(array $params = []) * Executes an ESQL request * * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-query-api.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ * format: string, // a short version of the Accept header, e.g. json, yaml diff --git a/src/Endpoints/Indices.php b/src/Endpoints/Indices.php index 4ad664e93..4db9a6af2 100644 --- a/src/Endpoints/Indices.php +++ b/src/Endpoints/Indices.php @@ -1969,6 +1969,7 @@ public function resolveIndex(array $params = []) * master_timeout: time, // Specify timeout for connection to master * wait_for_active_shards: string, // Set the number of active shards to wait for on the newly created rollover index before the operation returns. * lazy: boolean, // If set to true, the rollover action will only mark a data stream to signal that it needs to be rolled over at the next write. Only allowed on data streams. + * target_failure_store: boolean, // If set to true, the rollover action will be applied on the failure store of the data stream. * 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) @@ -1994,7 +1995,7 @@ public function rollover(array $params = []) $url = '/' . $this->encode($params['alias']) . '/_rollover'; $method = 'POST'; } - $url = $this->addQueryString($url, $params, ['timeout','dry_run','master_timeout','wait_for_active_shards','lazy','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['timeout','dry_run','master_timeout','wait_for_active_shards','lazy','target_failure_store','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', diff --git a/src/Endpoints/Inference.php b/src/Endpoints/Inference.php index 2feba9f54..04cca3027 100644 --- a/src/Endpoints/Inference.php +++ b/src/Endpoints/Inference.php @@ -76,7 +76,7 @@ public function deleteModel(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * inference_id: string, // (REQUIRED) The inference Id + * inference_id: string, // The inference Id * task_type: string, // The task type * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) * human: boolean, // Return human readable values for statistics. (DEFAULT: true) @@ -85,7 +85,6 @@ public function deleteModel(array $params = []) * 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 @@ -94,13 +93,15 @@ public function deleteModel(array $params = []) */ public function getModel(array $params = []) { - $this->checkRequiredParameters(['inference_id'], $params); - if (isset($params['task_type'])) { + if (isset($params['task_type']) && isset($params['inference_id'])) { $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); $method = 'GET'; - } else { + } elseif (isset($params['inference_id'])) { $url = '/_inference/' . $this->encode($params['inference_id']); $method = 'GET'; + } else { + $url = '/_inference'; + $method = 'GET'; } $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); $headers = [ diff --git a/src/Endpoints/Profiling.php b/src/Endpoints/Profiling.php index b7f94189b..b8a287ad1 100644 --- a/src/Endpoints/Profiling.php +++ b/src/Endpoints/Profiling.php @@ -57,7 +57,7 @@ public function flamegraph(array $params = []) $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', - 'Content-Type' => 'application/json' + 'Content-Type' => 'application/json', ]; return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); } @@ -92,7 +92,7 @@ public function stacktraces(array $params = []) $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', - 'Content-Type' => 'application/json' + 'Content-Type' => 'application/json', ]; return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); } @@ -131,4 +131,39 @@ public function status(array $params = []) ]; return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); } + + + /** + * Extracts a list of topN functions from Universal Profiling. + * + * @see https://www.elastic.co/guide/en/observability/current/universal-profiling.html + * + * @param array{ + * 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 filter conditions for stacktraces + * } $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 topnFunctions(array $params = []) + { + $this->checkRequiredParameters(['body'], $params); + $url = '/_profiling/topn/functions'; + $method = 'POST'; + + $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)); + } } diff --git a/src/Endpoints/SearchApplication.php b/src/Endpoints/SearchApplication.php index 6a282f7fc..e7769e2a6 100644 --- a/src/Endpoints/SearchApplication.php +++ b/src/Endpoints/SearchApplication.php @@ -371,6 +371,7 @@ public function renderQuery(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the search application to be searched + * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the 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) @@ -392,7 +393,7 @@ public function search(array $params = []) $url = '/_application/search_application/' . $this->encode($params['name']) . '/_search'; $method = empty($params['body']) ? 'GET' : 'POST'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['typed_keys','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', diff --git a/src/Endpoints/Security.php b/src/Endpoints/Security.php index 3e570591a..8a6e01359 100644 --- a/src/Endpoints/Security.php +++ b/src/Endpoints/Security.php @@ -867,6 +867,7 @@ public function enrollNode(array $params = []) * realm_name: string, // realm name of the user who created this API key to be retrieved * owner: boolean, // flag to query API keys owned by the currently authenticated user * with_limited_by: boolean, // flag to show the limited-by role descriptors of API Keys + * with_profile_uid: boolean, // flag to also retrieve the API Key's owner profile uid, if it exists * active_only: boolean, // flag to limit response to only active (not invalidated or expired) API keys * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) * human: boolean, // Return human readable values for statistics. (DEFAULT: true) @@ -886,7 +887,7 @@ public function getApiKey(array $params = []) $url = '/_security/api_key'; $method = 'GET'; - $url = $this->addQueryString($url, $params, ['id','name','username','realm_name','owner','with_limited_by','active_only','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['id','name','username','realm_name','owner','with_limited_by','with_profile_uid','active_only','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -1735,6 +1736,8 @@ public function putUser(array $params = []) * * @param array{ * with_limited_by: boolean, // flag to show the limited-by role descriptors of API Keys + * with_profile_uid: boolean, // flag to also retrieve the API Key's owner profile uid, if it exists + * typed_keys: boolean, // flag to prefix aggregation names by their respective types in the 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) @@ -1754,7 +1757,7 @@ public function queryApiKeys(array $params = []) $url = '/_security/_query/api_key'; $method = empty($params['body']) ? 'GET' : 'POST'; - $url = $this->addQueryString($url, $params, ['with_limited_by','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['with_limited_by','with_profile_uid','typed_keys','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', diff --git a/src/Endpoints/TextStructure.php b/src/Endpoints/TextStructure.php index d90f2e6a3..6bfa564a3 100644 --- a/src/Endpoints/TextStructure.php +++ b/src/Endpoints/TextStructure.php @@ -28,6 +28,99 @@ */ class TextStructure extends AbstractEndpoint { + /** + * Finds the structure of a text field in an index. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/find-field-structure.html + * + * @param array{ + * index: string, // The index containing the analyzed field + * field: string, // The field that should be analyzed + * documents_to_sample: int, // How many documents should be included in the analysis + * timeout: time, // Timeout after which the analysis will be aborted + * format: enum, // Optional parameter to specify the high level file format + * column_names: list, // Optional parameter containing a comma separated list of the column names for a delimited file + * delimiter: string, // Optional parameter to specify the delimiter character for a delimited file - must be a single character + * quote: string, // Optional parameter to specify the quote character for a delimited file - must be a single character + * should_trim_fields: boolean, // Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them + * grok_pattern: string, // Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file + * ecs_compatibility: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' + * timestamp_field: string, // Optional parameter to specify the timestamp field in the file + * timestamp_format: string, // Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format + * explain: boolean, // Whether to include a commentary on how the structure was derived + * 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 findFieldStructure(array $params = []) + { + $this->checkRequiredParameters(['index','field'], $params); + $url = '/_text_structure/find_field_structure'; + $method = 'GET'; + + $url = $this->addQueryString($url, $params, ['index','field','documents_to_sample','timeout','format','column_names','delimiter','quote','should_trim_fields','grok_pattern','ecs_compatibility','timestamp_field','timestamp_format','explain','pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + ]; + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); + } + + + /** + * Finds the structure of a list of messages. The messages must contain data that is suitable to be ingested into Elasticsearch. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/find-message-structure.html + * + * @param array{ + * timeout: time, // Timeout after which the analysis will be aborted + * format: enum, // Optional parameter to specify the high level file format + * column_names: list, // Optional parameter containing a comma separated list of the column names for a delimited file + * delimiter: string, // Optional parameter to specify the delimiter character for a delimited file - must be a single character + * quote: string, // Optional parameter to specify the quote character for a delimited file - must be a single character + * should_trim_fields: boolean, // Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them + * grok_pattern: string, // Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file + * ecs_compatibility: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' + * timestamp_field: string, // Optional parameter to specify the timestamp field in the file + * timestamp_format: string, // Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format + * explain: boolean, // Whether to include a commentary on how the structure was derived + * 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) JSON object with one field [messages], containing an array of messages to be analyzed + * } $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 findMessageStructure(array $params = []) + { + $this->checkRequiredParameters(['body'], $params); + $url = '/_text_structure/find_message_structure'; + $method = empty($params['body']) ? 'GET' : 'POST'; + + $url = $this->addQueryString($url, $params, ['timeout','format','column_names','delimiter','quote','should_trim_fields','grok_pattern','ecs_compatibility','timestamp_field','timestamp_format','explain','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)); + } + + /** * Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch. * diff --git a/src/Traits/NamespaceTrait.php b/src/Traits/NamespaceTrait.php index 5278536b9..2bfa63f50 100644 --- a/src/Traits/NamespaceTrait.php +++ b/src/Traits/NamespaceTrait.php @@ -22,7 +22,6 @@ use Elastic\Elasticsearch\Endpoints\Ccr; use Elastic\Elasticsearch\Endpoints\Cluster; use Elastic\Elasticsearch\Endpoints\Connector; -use Elastic\Elasticsearch\Endpoints\ConnectorSyncJob; use Elastic\Elasticsearch\Endpoints\DanglingIndices; use Elastic\Elasticsearch\Endpoints\Enrich; use Elastic\Elasticsearch\Endpoints\Eql; @@ -122,15 +121,6 @@ public function connector(): Connector } - public function connectorSyncJob(): ConnectorSyncJob - { - if (!isset($this->namespace['ConnectorSyncJob'])) { - $this->namespace['ConnectorSyncJob'] = new ConnectorSyncJob($this); - } - return $this->namespace['ConnectorSyncJob']; - } - - public function danglingIndices(): DanglingIndices { if (!isset($this->namespace['DanglingIndices'])) {