diff --git a/src/OpenSearch/Client.php b/src/OpenSearch/Client.php index 1db3a7f1..a068ba44 100644 --- a/src/OpenSearch/Client.php +++ b/src/OpenSearch/Client.php @@ -34,7 +34,7 @@ use OpenSearch\Namespaces\IndicesNamespace; use OpenSearch\Namespaces\IngestNamespace; use OpenSearch\Namespaces\KnnNamespace; -use OpenSearch\Namespaces\MachineLearningNamespace; +use OpenSearch\Namespaces\MlNamespace; use OpenSearch\Namespaces\MonitoringNamespace; use OpenSearch\Namespaces\NodesNamespace; use OpenSearch\Namespaces\NotificationsNamespace; @@ -118,6 +118,11 @@ class Client */ protected $knn; + /** + * @var MlNamespace + */ + protected $ml; + /** * @var MonitoringNamespace */ @@ -183,10 +188,6 @@ class Client */ protected $transforms; - /** - * @var MachineLearningNamespace - */ - protected $ml; /** * Client constructor @@ -207,6 +208,7 @@ public function __construct(Transport $transport, callable $endpoint, array $reg $this->indices = new IndicesNamespace($transport, $endpoint); $this->ingest = new IngestNamespace($transport, $endpoint); $this->knn = new KnnNamespace($transport, $endpoint); + $this->ml = new MlNamespace($transport, $endpoint); $this->monitoring = new MonitoringNamespace($transport, $endpoint); $this->nodes = new NodesNamespace($transport, $endpoint); $this->notifications = new NotificationsNamespace($transport, $endpoint); @@ -218,7 +220,6 @@ public function __construct(Transport $transport, callable $endpoint, array $reg $this->snapshot = new SnapshotNamespace($transport, $endpoint); $this->sql = new SqlNamespace($transport, $endpoint); $this->ssl = new SslNamespace($transport, $endpoint); - $this->ml = new MachineLearningNamespace($transport, $endpoint); $this->tasks = new TasksNamespace($transport, $endpoint); $this->transforms = new TransformsNamespace($transport, $endpoint); @@ -233,8 +234,8 @@ public function __construct(Transport $transport, callable $endpoint, array $reg * $params['_source_excludes'] = (any) A comma-separated list of source fields to exclude from the response. * $params['_source_includes'] = (any) A comma-separated list of source fields to include in the response. * $params['pipeline'] = (string) ID of the pipeline to use to preprocess incoming documents.If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request.If a final pipeline is configured it will always run, regardless of the value of this parameter. - * $params['refresh'] = (enum) If `true`, OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes.Valid values: `true`, `false`, `wait_for`. (Options = true,false,wait_for) - * $params['require_alias'] = (boolean) If `true`, the request’s actions must target an index alias. (Default = false) + * $params['refresh'] = (enum) If `true`, OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes.Valid values: `true`, `false`, `wait_for`. (Options = false,true,wait_for) + * $params['require_alias'] = (boolean) If `true`, the request's actions must target an index alias. (Default = false) * $params['routing'] = (string) Custom value used to route operations to a specific shard. * $params['timeout'] = (string) Period each action waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. * $params['wait_for_active_shards'] = (any) The number of shard copies that must be active before proceeding with the operation.Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). @@ -365,11 +366,11 @@ public function createPit(array $params = []) * $params['index'] = (string) Name of the target index. (Required) * $params['if_primary_term'] = (number) Only perform the operation if the document has this primary term. * $params['if_seq_no'] = (number) Only perform the operation if the document has this sequence number. - * $params['refresh'] = (enum) If `true`, OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes.Valid values: `true`, `false`, `wait_for`. (Options = true,false,wait_for) + * $params['refresh'] = (enum) If `true`, OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes.Valid values: `true`, `false`, `wait_for`. (Options = false,true,wait_for) * $params['routing'] = (string) Custom value used to route operations to a specific shard. * $params['timeout'] = (string) Period to wait for active shards. * $params['version'] = (number) Explicit version number for concurrency control.The specified version must match the current version of the document for the request to succeed. - * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = internal,external,external_gte,force) + * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = external,external_gte,force,internal) * $params['wait_for_active_shards'] = (any) The number of shard copies that must be active before proceeding with the operation.Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. @@ -440,7 +441,7 @@ public function deleteAllPits(array $params = []) * $params['scroll'] = (string) Period to retain the search context for scrolling. * $params['scroll_size'] = (number) Size of the scroll request that powers the operation. (Default = 100) * $params['search_timeout'] = (string) Explicit timeout for each search request.Defaults to no timeout. - * $params['search_type'] = (enum) The type of the search operation.Available options: `query_then_fetch`, `dfs_query_then_fetch`. (Options = query_then_fetch,dfs_query_then_fetch) + * $params['search_type'] = (enum) The type of the search operation.Available options: `query_then_fetch`, `dfs_query_then_fetch`. (Options = dfs_query_then_fetch,query_then_fetch) * $params['size'] = (integer) Deprecated, please use `max_docs` instead. * $params['slices'] = (any) The number of slices this task should be divided into. * $params['sort'] = (array) A comma-separated list of : pairs. @@ -563,7 +564,7 @@ public function deleteScript(array $params = []) * $params['routing'] = (string) Target the specified primary shard. * $params['stored_fields'] = (any) List of stored fields to return as part of a hit.If no fields are specified, no stored fields are included in the response.If this field is specified, the `_source` parameter defaults to false. * $params['version'] = (number) Explicit version number for concurrency control.The specified version must match the current version of the document for the request to succeed. - * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = internal,external,external_gte,force) + * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = external,external_gte,force,internal) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -602,7 +603,7 @@ public function exists(array $params = []): bool * $params['refresh'] = (boolean) If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes. * $params['routing'] = (string) Target the specified primary shard. * $params['version'] = (number) Explicit version number for concurrency control.The specified version must match the current version of the document for the request to succeed. - * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = internal,external,external_gte,force) + * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = external,external_gte,force,internal) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -716,7 +717,7 @@ public function fieldCaps(array $params = []) * $params['routing'] = (string) Target the specified primary shard. * $params['stored_fields'] = (any) List of stored fields to return as part of a hit.If no fields are specified, no stored fields are included in the response.If this field is specified, the `_source` parameter defaults to false. * $params['version'] = (number) Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. - * $params['version_type'] = (enum) Specific version type: internal, external, external_gte. (Options = internal,external,external_gte,force) + * $params['version_type'] = (enum) Specific version type: internal, external, external_gte. (Options = external,external_gte,force,internal) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -838,7 +839,7 @@ public function getScriptLanguages(array $params = []) * $params['refresh'] = (boolean) If true, OpenSearch refreshes the affected shards to make this operation visible to search. If false, do nothing with refreshes. * $params['routing'] = (string) Target the specified primary shard. * $params['version'] = (number) Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. - * $params['version_type'] = (enum) Specific version type: internal, external, external_gte. (Options = internal,external,external_gte,force) + * $params['version_type'] = (enum) Specific version type: internal, external, external_gte. (Options = external,external_gte,force,internal) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -868,14 +869,14 @@ public function getSource(array $params = []) * $params['id'] = (string) Unique identifier for the document. * $params['if_primary_term'] = (number) Only perform the operation if the document has this primary term. * $params['if_seq_no'] = (number) Only perform the operation if the document has this sequence number. - * $params['op_type'] = (enum) Set to create to only index the document if it does not already exist (put if absent).If a document with the specified `_id` already exists, the indexing operation will fail.Same as using the `/_create` endpoint.Valid values: `index`, `create`.If document id is specified, it defaults to `index`.Otherwise, it defaults to `create`. (Options = index,create) + * $params['op_type'] = (enum) Set to create to only index the document if it does not already exist (put if absent).If a document with the specified `_id` already exists, the indexing operation will fail.Same as using the `/_create` endpoint.Valid values: `index`, `create`.If document id is specified, it defaults to `index`.Otherwise, it defaults to `create`. (Options = create,index) * $params['pipeline'] = (string) ID of the pipeline to use to preprocess incoming documents.If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request.If a final pipeline is configured it will always run, regardless of the value of this parameter. - * $params['refresh'] = (enum) If `true`, OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes.Valid values: `true`, `false`, `wait_for`. (Options = true,false,wait_for) + * $params['refresh'] = (enum) If `true`, OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes.Valid values: `true`, `false`, `wait_for`. (Options = false,true,wait_for) * $params['require_alias'] = (boolean) If `true`, the destination must be an index alias. (Default = false) * $params['routing'] = (string) Custom value used to route operations to a specific shard. * $params['timeout'] = (string) Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. * $params['version'] = (number) Explicit version number for concurrency control.The specified version must match the current version of the document for the request to succeed. - * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = internal,external,external_gte,force) + * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = external,external_gte,force,internal) * $params['wait_for_active_shards'] = (any) The number of shard copies that must be active before proceeding with the operation.Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. @@ -966,7 +967,7 @@ public function mget(array $params = []) * $params['max_concurrent_shard_requests'] = (number) Maximum number of concurrent shard requests that each sub-search request executes per node. (Default = 5) * $params['pre_filter_shard_size'] = (number) Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint. * $params['rest_total_hits_as_int'] = (boolean) If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object. (Default = false) - * $params['search_type'] = (enum) Indicates whether global term and document frequencies should be used when scoring returned documents. (Options = query_then_fetch,dfs_query_then_fetch) + * $params['search_type'] = (enum) Indicates whether global term and document frequencies should be used when scoring returned documents. (Options = dfs_query_then_fetch,query_then_fetch) * $params['typed_keys'] = (boolean) Specifies whether aggregation and suggester names should be prefixed by their respective types in the response. * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. @@ -998,7 +999,7 @@ public function msearch(array $params = []) * $params['ccs_minimize_roundtrips'] = (boolean) If `true`, network round-trips are minimized for cross-cluster search requests. (Default = true) * $params['max_concurrent_searches'] = (number) Maximum number of concurrent searches the API can run. * $params['rest_total_hits_as_int'] = (boolean) If `true`, the response returns `hits.total` as an integer.If `false`, it returns `hits.total` as an object. (Default = false) - * $params['search_type'] = (enum) The type of the search operation.Available options: `query_then_fetch`, `dfs_query_then_fetch`. (Options = query_then_fetch,dfs_query_then_fetch) + * $params['search_type'] = (enum) The type of the search operation.Available options: `query_then_fetch`, `dfs_query_then_fetch`. (Options = dfs_query_then_fetch,query_then_fetch) * $params['typed_keys'] = (boolean) If `true`, the response prefixes aggregation and suggester names with their respective types. * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. @@ -1038,7 +1039,7 @@ public function msearchTemplate(array $params = []) * $params['routing'] = (string) Custom value used to route operations to a specific shard. * $params['term_statistics'] = (boolean) If true, the response includes term frequency and document frequency. (Default = false) * $params['version'] = (number) If `true`, returns the document version as part of a hit. - * $params['version_type'] = (enum) Specific version type. (Options = internal,external,external_gte,force) + * $params['version_type'] = (enum) Specific version type. (Options = external,external_gte,force,internal) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -1156,7 +1157,7 @@ public function rankEval(array $params = []) * $params['refresh'] = (boolean) If `true`, the request refreshes affected shards to make this operation visible to search. * $params['requests_per_second'] = (number) The throttle for this request in sub-requests per second.Defaults to no throttle. (Default = 0) * $params['scroll'] = (string) Specifies how long a consistent view of the index should be maintained for scrolled search. - * $params['slices'] = (any) The number of slices this task should be divided into.Defaults to 1 slice, meaning the task isn’t sliced into subtasks. + * $params['slices'] = (any) The number of slices this task should be divided into.Defaults to 1 slice, meaning the task isn't sliced into subtasks. * $params['timeout'] = (string) Period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards. * $params['wait_for_active_shards'] = (any) The number of shard copies that must be active before proceeding with the operation.Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). * $params['wait_for_completion'] = (boolean) If `true`, the request blocks until the operation is complete. (Default = true) @@ -1261,7 +1262,7 @@ public function scriptsPainlessExecute(array $params = []) * Allows to retrieve a large numbers of results from a single search request. * * $params['scroll_id'] = DEPRECATED (string) The scroll ID - * $params['rest_total_hits_as_int'] = (boolean) If true, the API response’s hit.total property is returned as an integer. If false, the API response’s hit.total property is returned as an object. (Default = false) + * $params['rest_total_hits_as_int'] = (boolean) If true, the API response's hit.total property is returned as an integer. If false, the API response's hit.total property is returned as an object. (Default = false) * $params['scroll'] = (string) Period to retain the search context for scrolling. * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. @@ -1320,14 +1321,14 @@ public function scroll(array $params = []) * $params['routing'] = (string) Custom value used to route operations to a specific shard. * $params['scroll'] = (string) Period to retain the search context for scrolling. See Scroll search results.By default, this value cannot exceed `1d` (24 hours).You can change this limit using the `search.max_keep_alive` cluster-level setting. * $params['search_pipeline'] = (string) Customizable sequence of processing stages applied to search queries. - * $params['search_type'] = (enum) How distributed term frequencies are calculated for relevance scoring. (Options = query_then_fetch,dfs_query_then_fetch) + * $params['search_type'] = (enum) How distributed term frequencies are calculated for relevance scoring. (Options = dfs_query_then_fetch,query_then_fetch) * $params['seq_no_primary_term'] = (boolean) If `true`, returns sequence number and primary term of the last modification of each hit. * $params['size'] = (number) Defines the number of hits to return.By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.To page through more hits, use the `search_after` parameter. (Default = 10) * $params['sort'] = (any) A comma-separated list of : pairs. * $params['stats'] = (array) Specific `tag` of the request for logging and statistical purposes. * $params['stored_fields'] = (any) A comma-separated list of stored fields to return as part of a hit.If no fields are specified, no stored fields are included in the response.If this field is specified, the `_source` parameter defaults to `false`.You can pass `_source: true` to return both source fields and stored fields in the search response. * $params['suggest_field'] = (string) Specifies which field to use for suggestions. - * $params['suggest_mode'] = (enum) Specifies the suggest mode.This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. (Options = missing,popular,always) + * $params['suggest_mode'] = (enum) Specifies the suggest mode.This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. (Options = always,missing,popular) * $params['suggest_size'] = (number) Number of suggestions to return.This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. * $params['suggest_text'] = (string) The source text for which the suggestions should be returned.This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. * $params['terminate_after'] = (number) Maximum number of documents to collect for each shard.If a query reaches this limit, OpenSearch terminates the query early.OpenSearch collects documents before sorting.Use with caution.OpenSearch applies this parameter to each shard handling the request.When possible, let OpenSearch perform early termination automatically.Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers.If set to `0` (default), the query does not terminate early. @@ -1404,7 +1405,7 @@ public function searchShards(array $params = []) * $params['rest_total_hits_as_int'] = (boolean) If true, hits.total are rendered as an integer in the response. (Default = false) * $params['routing'] = (string) Custom value used to route operations to a specific shard. * $params['scroll'] = (string) Specifies how long a consistent view of the indexshould be maintained for scrolled search. - * $params['search_type'] = (enum) The type of the search operation. (Options = query_then_fetch,dfs_query_then_fetch) + * $params['search_type'] = (enum) The type of the search operation. (Options = dfs_query_then_fetch,query_then_fetch) * $params['typed_keys'] = (boolean) If `true`, the response prefixes aggregation and suggester names with their respective types. * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. @@ -1444,7 +1445,7 @@ public function searchTemplate(array $params = []) * $params['routing'] = (string) Custom value used to route operations to a specific shard. * $params['term_statistics'] = (boolean) If `true`, the response includes term frequency and document frequency. (Default = false) * $params['version'] = (number) If `true`, returns the document version as part of a hit. - * $params['version_type'] = (enum) Specific version type. (Options = internal,external,external_gte,force) + * $params['version_type'] = (enum) Specific version type. (Options = external,external_gte,force,internal) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -1481,7 +1482,7 @@ public function termvectors(array $params = []) * $params['if_primary_term'] = (number) Only perform the operation if the document has this primary term. * $params['if_seq_no'] = (number) Only perform the operation if the document has this sequence number. * $params['lang'] = (string) The script language. (Default = painless) - * $params['refresh'] = (enum) If 'true', OpenSearch refreshes the affected shards to make this operationvisible to search, if 'wait_for' then wait for a refresh to make this operationvisible to search, if 'false' do nothing with refreshes. (Options = true,false,wait_for) + * $params['refresh'] = (enum) If 'true', OpenSearch refreshes the affected shards to make this operationvisible to search, if 'wait_for' then wait for a refresh to make this operationvisible to search, if 'false' do nothing with refreshes. (Options = false,true,wait_for) * $params['require_alias'] = (boolean) If true, the destination must be an index alias. (Default = false) * $params['retry_on_conflict'] = (number) Specify how many times should the operation be retried when a conflict occurs. (Default = 0) * $params['routing'] = (string) Custom value used to route operations to a specific shard. @@ -1540,7 +1541,7 @@ public function update(array $params = []) * $params['scroll'] = (string) Period to retain the search context for scrolling. * $params['scroll_size'] = (number) Size of the scroll request that powers the operation. (Default = 100) * $params['search_timeout'] = (string) Explicit timeout for each search request. - * $params['search_type'] = (enum) The type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`. (Options = query_then_fetch,dfs_query_then_fetch) + * $params['search_type'] = (enum) The type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`. (Options = dfs_query_then_fetch,query_then_fetch) * $params['size'] = (integer) Deprecated, please use `max_docs` instead. * $params['slices'] = (any) The number of slices this task should be divided into. * $params['sort'] = (array) A comma-separated list of : pairs. @@ -1707,6 +1708,13 @@ public function knn(): KnnNamespace { return $this->knn; } + /** + * Returns the ml namespace + */ + public function ml(): MlNamespace + { + return $this->ml; + } /** * Returns the monitoring namespace */ @@ -1798,10 +1806,6 @@ public function transforms(): TransformsNamespace { return $this->transforms; } - public function ml(): MachineLearningNamespace - { - return $this->ml; - } /** * Catchall for registered namespaces diff --git a/src/OpenSearch/Endpoints/Indices/ClearCache.php b/src/OpenSearch/Endpoints/Indices/ClearCache.php index deafb1eb..dfc086a0 100644 --- a/src/OpenSearch/Endpoints/Indices/ClearCache.php +++ b/src/OpenSearch/Endpoints/Indices/ClearCache.php @@ -44,6 +44,7 @@ public function getParamWhitelist(): array 'expand_wildcards', 'fielddata', 'fields', + 'file', 'ignore_unavailable', 'index', 'query', diff --git a/src/OpenSearch/Endpoints/Indices/GetMapping.php b/src/OpenSearch/Endpoints/Indices/GetMapping.php index 0641e8ed..d80a8332 100644 --- a/src/OpenSearch/Endpoints/Indices/GetMapping.php +++ b/src/OpenSearch/Endpoints/Indices/GetMapping.php @@ -44,6 +44,7 @@ public function getParamWhitelist(): array 'cluster_manager_timeout', 'expand_wildcards', 'ignore_unavailable', + 'index', 'local', 'master_timeout', 'pretty', diff --git a/src/OpenSearch/Endpoints/MachineLearning/ModelGroups/DeleteModelGroup.php b/src/OpenSearch/Endpoints/MachineLearning/ModelGroups/DeleteModelGroup.php deleted file mode 100644 index f917f4a8..00000000 --- a/src/OpenSearch/Endpoints/MachineLearning/ModelGroups/DeleteModelGroup.php +++ /dev/null @@ -1,51 +0,0 @@ -id) { - return "/_plugins/_ml/model_groups/$this->id"; - } - - throw new RuntimeException( - 'id is required for delete' - ); - - } - - /** - * @return string - */ - public function getMethod(): string - { - return 'DELETE'; - } -} diff --git a/src/OpenSearch/Endpoints/MachineLearning/ModelGroups/RegisterModelGroup.php b/src/OpenSearch/Endpoints/MachineLearning/ModelGroups/RegisterModelGroup.php deleted file mode 100644 index cc38d323..00000000 --- a/src/OpenSearch/Endpoints/MachineLearning/ModelGroups/RegisterModelGroup.php +++ /dev/null @@ -1,43 +0,0 @@ -id) { - return "/_plugins/_ml/models/$this->id"; - } - - throw new RuntimeException( - 'id is required for delete' - ); - - } - - /** - * @return string - */ - public function getMethod(): string - { - return 'DELETE'; - } -} diff --git a/src/OpenSearch/Endpoints/MachineLearning/Models/GetModels.php b/src/OpenSearch/Endpoints/MachineLearning/Models/GetModels.php deleted file mode 100644 index 7f714ec4..00000000 --- a/src/OpenSearch/Endpoints/MachineLearning/Models/GetModels.php +++ /dev/null @@ -1,43 +0,0 @@ -id) { - return "/_plugins/_ml/tasks/$this->id"; - } - - throw new RuntimeException( - 'id is required for get' - ); - - } - - /** - * @return string - */ - public function getMethod(): string - { - return 'GET'; - } -} diff --git a/src/OpenSearch/Endpoints/MachineLearning/Connectors/CreateConnector.php b/src/OpenSearch/Endpoints/Ml/CreateConnector.php similarity index 92% rename from src/OpenSearch/Endpoints/MachineLearning/Connectors/CreateConnector.php rename to src/OpenSearch/Endpoints/Ml/CreateConnector.php index 4bd4d6ad..144debcb 100644 --- a/src/OpenSearch/Endpoints/MachineLearning/Connectors/CreateConnector.php +++ b/src/OpenSearch/Endpoints/Ml/CreateConnector.php @@ -11,7 +11,7 @@ * compatible open source license. */ -namespace OpenSearch\Endpoints\MachineLearning\Connectors; +namespace OpenSearch\Endpoints\Ml; use OpenSearch\Endpoints\AbstractEndpoint; diff --git a/src/OpenSearch/Endpoints/MachineLearning/Connectors/DeleteConnector.php b/src/OpenSearch/Endpoints/Ml/DeleteConnector.php similarity index 94% rename from src/OpenSearch/Endpoints/MachineLearning/Connectors/DeleteConnector.php rename to src/OpenSearch/Endpoints/Ml/DeleteConnector.php index cd95fcaf..3eec653b 100644 --- a/src/OpenSearch/Endpoints/MachineLearning/Connectors/DeleteConnector.php +++ b/src/OpenSearch/Endpoints/Ml/DeleteConnector.php @@ -11,7 +11,7 @@ * compatible open source license. */ -namespace OpenSearch\Endpoints\MachineLearning\Connectors; +namespace OpenSearch\Endpoints\Ml; use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; diff --git a/src/OpenSearch/Endpoints/Ml/DeleteModel.php b/src/OpenSearch/Endpoints/Ml/DeleteModel.php new file mode 100644 index 00000000..4386b651 --- /dev/null +++ b/src/OpenSearch/Endpoints/Ml/DeleteModel.php @@ -0,0 +1,50 @@ +id ?? null; + if (isset($id)) { + return "/_plugins/_ml/models/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.delete_model'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } +} diff --git a/src/OpenSearch/Endpoints/Ml/DeleteModelGroup.php b/src/OpenSearch/Endpoints/Ml/DeleteModelGroup.php new file mode 100644 index 00000000..40efdd36 --- /dev/null +++ b/src/OpenSearch/Endpoints/Ml/DeleteModelGroup.php @@ -0,0 +1,50 @@ +id ?? null; + if (isset($id)) { + return "/_plugins/_ml/model_groups/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.delete_model_group'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } +} diff --git a/src/OpenSearch/Endpoints/MachineLearning/Models/DeployModel.php b/src/OpenSearch/Endpoints/Ml/DeployModel.php similarity index 94% rename from src/OpenSearch/Endpoints/MachineLearning/Models/DeployModel.php rename to src/OpenSearch/Endpoints/Ml/DeployModel.php index 48bfede1..ba181822 100644 --- a/src/OpenSearch/Endpoints/MachineLearning/Models/DeployModel.php +++ b/src/OpenSearch/Endpoints/Ml/DeployModel.php @@ -11,7 +11,7 @@ * compatible open source license. */ -namespace OpenSearch\Endpoints\MachineLearning\Models; +namespace OpenSearch\Endpoints\Ml; use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; diff --git a/src/OpenSearch/Endpoints/MachineLearning/Connectors/GetConnector.php b/src/OpenSearch/Endpoints/Ml/GetConnector.php similarity index 94% rename from src/OpenSearch/Endpoints/MachineLearning/Connectors/GetConnector.php rename to src/OpenSearch/Endpoints/Ml/GetConnector.php index fef1aa17..9a612a63 100644 --- a/src/OpenSearch/Endpoints/MachineLearning/Connectors/GetConnector.php +++ b/src/OpenSearch/Endpoints/Ml/GetConnector.php @@ -11,7 +11,7 @@ * compatible open source license. */ -namespace OpenSearch\Endpoints\MachineLearning\Connectors; +namespace OpenSearch\Endpoints\Ml; use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; diff --git a/src/OpenSearch/Endpoints/MachineLearning/Connectors/GetConnectors.php b/src/OpenSearch/Endpoints/Ml/GetConnectors.php similarity index 92% rename from src/OpenSearch/Endpoints/MachineLearning/Connectors/GetConnectors.php rename to src/OpenSearch/Endpoints/Ml/GetConnectors.php index e5e5d698..4d18eb3a 100644 --- a/src/OpenSearch/Endpoints/MachineLearning/Connectors/GetConnectors.php +++ b/src/OpenSearch/Endpoints/Ml/GetConnectors.php @@ -11,7 +11,7 @@ * compatible open source license. */ -namespace OpenSearch\Endpoints\MachineLearning\Connectors; +namespace OpenSearch\Endpoints\Ml; use OpenSearch\Endpoints\AbstractEndpoint; diff --git a/src/OpenSearch/Endpoints/MachineLearning/Models/GetModel.php b/src/OpenSearch/Endpoints/Ml/GetModel.php similarity index 94% rename from src/OpenSearch/Endpoints/MachineLearning/Models/GetModel.php rename to src/OpenSearch/Endpoints/Ml/GetModel.php index f2c333d9..eb284d7a 100644 --- a/src/OpenSearch/Endpoints/MachineLearning/Models/GetModel.php +++ b/src/OpenSearch/Endpoints/Ml/GetModel.php @@ -11,7 +11,7 @@ * compatible open source license. */ -namespace OpenSearch\Endpoints\MachineLearning\Models; +namespace OpenSearch\Endpoints\Ml; use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; diff --git a/src/OpenSearch/Endpoints/Ml/GetModelGroup.php b/src/OpenSearch/Endpoints/Ml/GetModelGroup.php new file mode 100644 index 00000000..f061ea6c --- /dev/null +++ b/src/OpenSearch/Endpoints/Ml/GetModelGroup.php @@ -0,0 +1,62 @@ +model_group_id ?? null; + if (isset($model_group_id)) { + return "/_plugins/_ml/model_groups/$model_group_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_model_group'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setModelGroupId($model_group_id): GetModelGroup + { + if (isset($model_group_id) !== true) { + return $this; + } + $this->model_group_id = $model_group_id; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/MachineLearning/ModelGroups/GetModelGroups.php b/src/OpenSearch/Endpoints/Ml/GetModelGroups.php similarity index 92% rename from src/OpenSearch/Endpoints/MachineLearning/ModelGroups/GetModelGroups.php rename to src/OpenSearch/Endpoints/Ml/GetModelGroups.php index 0dd03bbc..3a50731d 100644 --- a/src/OpenSearch/Endpoints/MachineLearning/ModelGroups/GetModelGroups.php +++ b/src/OpenSearch/Endpoints/Ml/GetModelGroups.php @@ -11,7 +11,7 @@ * compatible open source license. */ -namespace OpenSearch\Endpoints\MachineLearning\ModelGroups; +namespace OpenSearch\Endpoints\Ml; use OpenSearch\Endpoints\AbstractEndpoint; diff --git a/src/OpenSearch/Endpoints/Ml/GetTask.php b/src/OpenSearch/Endpoints/Ml/GetTask.php new file mode 100644 index 00000000..dfbecaab --- /dev/null +++ b/src/OpenSearch/Endpoints/Ml/GetTask.php @@ -0,0 +1,50 @@ +id ?? null; + if (isset($id)) { + return "/_plugins/_ml/tasks/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_task'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/src/OpenSearch/Endpoints/MachineLearning/Models/Predict.php b/src/OpenSearch/Endpoints/Ml/Predict.php similarity index 94% rename from src/OpenSearch/Endpoints/MachineLearning/Models/Predict.php rename to src/OpenSearch/Endpoints/Ml/Predict.php index eba6ea55..034905f5 100644 --- a/src/OpenSearch/Endpoints/MachineLearning/Models/Predict.php +++ b/src/OpenSearch/Endpoints/Ml/Predict.php @@ -11,7 +11,7 @@ * compatible open source license. */ -namespace OpenSearch\Endpoints\MachineLearning\Models; +namespace OpenSearch\Endpoints\Ml; use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; diff --git a/src/OpenSearch/Endpoints/Ml/RegisterModel.php b/src/OpenSearch/Endpoints/Ml/RegisterModel.php new file mode 100644 index 00000000..698659c9 --- /dev/null +++ b/src/OpenSearch/Endpoints/Ml/RegisterModel.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Ml/RegisterModelGroup.php b/src/OpenSearch/Endpoints/Ml/RegisterModelGroup.php new file mode 100644 index 00000000..046581e8 --- /dev/null +++ b/src/OpenSearch/Endpoints/Ml/RegisterModelGroup.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Ml/SearchModels.php b/src/OpenSearch/Endpoints/Ml/SearchModels.php new file mode 100644 index 00000000..a6874ac1 --- /dev/null +++ b/src/OpenSearch/Endpoints/Ml/SearchModels.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/MachineLearning/Models/UndeployModel.php b/src/OpenSearch/Endpoints/Ml/UndeployModel.php similarity index 94% rename from src/OpenSearch/Endpoints/MachineLearning/Models/UndeployModel.php rename to src/OpenSearch/Endpoints/Ml/UndeployModel.php index 3dbdac7f..1b9dd7fd 100644 --- a/src/OpenSearch/Endpoints/MachineLearning/Models/UndeployModel.php +++ b/src/OpenSearch/Endpoints/Ml/UndeployModel.php @@ -11,7 +11,7 @@ * compatible open source license. */ -namespace OpenSearch\Endpoints\MachineLearning\Models; +namespace OpenSearch\Endpoints\Ml; use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; diff --git a/src/OpenSearch/Endpoints/MachineLearning/ModelGroups/UpdateModelGroup.php b/src/OpenSearch/Endpoints/Ml/UpdateModelGroup.php similarity index 93% rename from src/OpenSearch/Endpoints/MachineLearning/ModelGroups/UpdateModelGroup.php rename to src/OpenSearch/Endpoints/Ml/UpdateModelGroup.php index 7f976984..48d3809c 100644 --- a/src/OpenSearch/Endpoints/MachineLearning/ModelGroups/UpdateModelGroup.php +++ b/src/OpenSearch/Endpoints/Ml/UpdateModelGroup.php @@ -11,7 +11,7 @@ * compatible open source license. */ -namespace OpenSearch\Endpoints\MachineLearning\ModelGroups; +namespace OpenSearch\Endpoints\Ml; use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; diff --git a/src/OpenSearch/Namespaces/CatNamespace.php b/src/OpenSearch/Namespaces/CatNamespace.php index 9a3196d4..d51d8223 100644 --- a/src/OpenSearch/Namespaces/CatNamespace.php +++ b/src/OpenSearch/Namespaces/CatNamespace.php @@ -64,7 +64,7 @@ public function aliases(array $params = []) /** * Lists all active point-in-time segments. * - * $params['bytes'] = (enum) The unit in which to display byte values. (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) + * $params['bytes'] = (enum) The unit in which to display byte values. (Options = b,g,gb,k,kb,m,mb,p,pb,t,tb) * $params['format'] = (string) A short version of the Accept header, e.g. json, yaml. * $params['h'] = (array) Comma-separated list of column names to display. * $params['help'] = (boolean) Return help information. (Default = false) @@ -91,7 +91,7 @@ public function allPitSegments(array $params = []) * Provides a snapshot of how many shards are allocated to each data node and how much disk space they are using. * * $params['node_id'] = (array) Comma-separated list of node identifiers or names used to limit the returned information. - * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) + * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,g,gb,k,kb,m,mb,p,pb,t,tb) * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node. * $params['format'] = (string) A short version of the Accept header, e.g. json, yaml. * $params['h'] = (array) Comma-separated list of column names to display. @@ -181,7 +181,7 @@ public function count(array $params = []) * Shows how much heap memory is currently being used by fielddata on every data node in the cluster. * * $params['fields'] = (array) Comma-separated list of fields used to limit returned information. To retrieve all fields, omit this parameter. - * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) + * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,g,gb,k,kb,m,mb,p,pb,t,tb) * $params['format'] = (string) A short version of the Accept header, e.g. json, yaml. * $params['h'] = (array) Comma-separated list of column names to display. * $params['help'] = (boolean) Return help information. (Default = false) @@ -214,7 +214,7 @@ public function fielddata(array $params = []) * $params['h'] = (array) Comma-separated list of column names to display. * $params['help'] = (boolean) Return help information. (Default = false) * $params['s'] = (array) Comma-separated list of column names or column aliases to sort by. - * $params['time'] = (enum) The unit used to display time values. (Options = nanos,micros,ms,s,m,h,d) + * $params['time'] = (enum) The unit used to display time values. (Options = d,h,m,micros,ms,nanos,s) * $params['ts'] = (boolean) If true, returns `HH:MM:SS` and Unix epoch timestamps. (Default = true) * $params['v'] = (boolean) Verbose mode. Display column headers. (Default = false) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. @@ -258,19 +258,19 @@ public function help(array $params = []) * Returns information about indices: number of primaries and replicas, document counts, disk size, ... * * $params['index'] = (array) Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. - * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) + * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,g,gb,k,kb,m,mb,p,pb,t,tb) * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node. * $params['expand_wildcards'] = (any) The type of index that wildcard patterns can match. * $params['format'] = (string) A short version of the Accept header, e.g. json, yaml. * $params['h'] = (array) Comma-separated list of column names to display. - * $params['health'] = (enum) The health status used to limit returned indices. By default, the response includes indices of any health status. (Options = green,yellow,red) + * $params['health'] = (enum) The health status used to limit returned indices. By default, the response includes indices of any health status. (Options = green,red,yellow) * $params['help'] = (boolean) Return help information. (Default = false) * $params['include_unloaded_segments'] = (boolean) If true, the response includes information from segments that are not loaded into memory. (Default = false) * $params['local'] = (boolean) Return local information, do not retrieve the state from cluster-manager node. (Default = false) * $params['master_timeout'] = (string) Operation timeout for connection to master node. * $params['pri'] = (boolean) If true, the response only includes information from primary shards. (Default = false) * $params['s'] = (array) Comma-separated list of column names or column aliases to sort by. - * $params['time'] = (enum) The unit used to display time values. (Options = nanos,micros,ms,s,m,h,d) + * $params['time'] = (enum) The unit used to display time values. (Options = d,h,m,micros,ms,nanos,s) * $params['v'] = (boolean) Verbose mode. Display column headers. (Default = false) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. @@ -351,7 +351,7 @@ public function nodeattrs(array $params = []) /** * Returns basic statistics about performance of cluster nodes. * - * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) + * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,g,gb,k,kb,m,mb,p,pb,t,tb) * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node. * $params['format'] = (string) A short version of the Accept header, e.g. json, yaml. * $params['full_id'] = (any) If `true`, return the full node ID. If `false`, return the shortened node ID. (Default = ) @@ -360,7 +360,7 @@ public function nodeattrs(array $params = []) * $params['local'] = (boolean) Return local information, do not retrieve the state from cluster-manager node. (Default = false) * $params['master_timeout'] = (string) Operation timeout for connection to master node. * $params['s'] = (array) Comma-separated list of column names or column aliases to sort by. - * $params['time'] = (enum) The unit in which to display time values. (Options = nanos,micros,ms,s,m,h,d) + * $params['time'] = (enum) The unit in which to display time values. (Options = d,h,m,micros,ms,nanos,s) * $params['v'] = (boolean) Verbose mode. Display column headers. (Default = false) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. @@ -389,7 +389,7 @@ public function nodes(array $params = []) * $params['local'] = (boolean) Return local information, do not retrieve the state from cluster-manager node. (Default = false) * $params['master_timeout'] = (string) Operation timeout for connection to master node. * $params['s'] = (array) Comma-separated list of column names or column aliases to sort by. - * $params['time'] = (enum) The unit in which to display time values. (Options = nanos,micros,ms,s,m,h,d) + * $params['time'] = (enum) The unit in which to display time values. (Options = d,h,m,micros,ms,nanos,s) * $params['v'] = (boolean) Verbose mode. Display column headers. (Default = false) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. @@ -411,7 +411,7 @@ public function pendingTasks(array $params = []) /** * List segments for one or several PITs. * - * $params['bytes'] = (enum) The unit in which to display byte values. (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) + * $params['bytes'] = (enum) The unit in which to display byte values. (Options = b,g,gb,k,kb,m,mb,p,pb,t,tb) * $params['format'] = (string) A short version of the Accept header, e.g. json, yaml. * $params['h'] = (array) Comma-separated list of column names to display. * $params['help'] = (boolean) Return help information. (Default = false) @@ -470,13 +470,13 @@ public function plugins(array $params = []) * * $params['index'] = (array) A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. * $params['active_only'] = (boolean) If `true`, the response only includes ongoing shard recoveries. (Default = false) - * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) + * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,g,gb,k,kb,m,mb,p,pb,t,tb) * $params['detailed'] = (boolean) If `true`, the response includes detailed information about shard recoveries. (Default = false) * $params['format'] = (string) A short version of the Accept header, e.g. json, yaml. * $params['h'] = (array) Comma-separated list of column names to display. * $params['help'] = (boolean) Return help information. (Default = false) * $params['s'] = (array) Comma-separated list of column names or column aliases to sort by. - * $params['time'] = (enum) The unit in which to display time values. (Options = nanos,micros,ms,s,m,h,d) + * $params['time'] = (enum) The unit in which to display time values. (Options = d,h,m,micros,ms,nanos,s) * $params['v'] = (boolean) Verbose mode. Display column headers. (Default = false) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. @@ -532,7 +532,7 @@ public function repositories(array $params = []) * $params['index'] = (array) Comma-separated list or wildcard expression of index names to limit the returned information. * $params['active_only'] = (boolean) If `true`, the response only includes ongoing segment replication events. (Default = false) * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). - * $params['bytes'] = (enum) The unit in which to display byte values. (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) + * $params['bytes'] = (enum) The unit in which to display byte values. (Options = b,g,gb,k,kb,m,mb,p,pb,t,tb) * $params['completed_only'] = (boolean) If `true`, the response only includes latest completed segment replication events. (Default = false) * $params['detailed'] = (boolean) If `true`, the response includes detailed information about segment replications. (Default = false) * $params['expand_wildcards'] = (any) Whether to expand wildcard expression to concrete indices that are open, closed or both. @@ -543,7 +543,7 @@ public function repositories(array $params = []) * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed). * $params['s'] = (array) Comma-separated list of column names or column aliases to sort by. * $params['shards'] = (array) Comma-separated list of shards to display. - * $params['time'] = (enum) The unit in which to display time values. (Options = nanos,micros,ms,s,m,h,d) + * $params['time'] = (enum) The unit in which to display time values. (Options = d,h,m,micros,ms,nanos,s) * $params['timeout'] = (string) Operation timeout. * $params['v'] = (boolean) Verbose mode. Display column headers. (Default = false) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. @@ -570,7 +570,7 @@ public function segmentReplication(array $params = []) * Provides low-level information about the segments in the shards of an index. * * $params['index'] = (array) A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. - * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) + * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,g,gb,k,kb,m,mb,p,pb,t,tb) * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node. * $params['format'] = (string) A short version of the Accept header, e.g. json, yaml. * $params['h'] = (array) Comma-separated list of column names to display. @@ -602,7 +602,7 @@ public function segments(array $params = []) * Provides a detailed view of shard allocation on nodes. * * $params['index'] = (array) A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. - * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) + * $params['bytes'] = (enum) The unit used to display byte values. (Options = b,g,gb,k,kb,m,mb,p,pb,t,tb) * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node. * $params['format'] = (string) A short version of the Accept header, e.g. json, yaml. * $params['h'] = (array) Comma-separated list of column names to display. @@ -610,7 +610,7 @@ public function segments(array $params = []) * $params['local'] = (boolean) Return local information, do not retrieve the state from cluster-manager node. (Default = false) * $params['master_timeout'] = (string) Operation timeout for connection to master node. * $params['s'] = (array) Comma-separated list of column names or column aliases to sort by. - * $params['time'] = (enum) The unit in which to display time values. (Options = nanos,micros,ms,s,m,h,d) + * $params['time'] = (enum) The unit in which to display time values. (Options = d,h,m,micros,ms,nanos,s) * $params['v'] = (boolean) Verbose mode. Display column headers. (Default = false) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. @@ -643,7 +643,7 @@ public function shards(array $params = []) * $params['ignore_unavailable'] = (boolean) If `true`, the response does not include information from unavailable snapshots. (Default = false) * $params['master_timeout'] = (string) Operation timeout for connection to master node. * $params['s'] = (array) Comma-separated list of column names or column aliases to sort by. - * $params['time'] = (enum) The unit in which to display time values. (Options = nanos,micros,ms,s,m,h,d) + * $params['time'] = (enum) The unit in which to display time values. (Options = d,h,m,micros,ms,nanos,s) * $params['v'] = (boolean) Verbose mode. Display column headers. (Default = false) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. @@ -674,7 +674,7 @@ public function snapshots(array $params = []) * $params['h'] = (array) Comma-separated list of column names to display. * $params['help'] = (boolean) Return help information. (Default = false) * $params['s'] = (array) Comma-separated list of column names or column aliases to sort by. - * $params['time'] = (enum) The unit in which to display time values. (Options = nanos,micros,ms,s,m,h,d) + * $params['time'] = (enum) The unit in which to display time values. (Options = d,h,m,micros,ms,nanos,s) * $params['v'] = (boolean) Verbose mode. Display column headers. (Default = false) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. diff --git a/src/OpenSearch/Namespaces/ClusterNamespace.php b/src/OpenSearch/Namespaces/ClusterNamespace.php index c0e3c9fc..dbe85126 100644 --- a/src/OpenSearch/Namespaces/ClusterNamespace.php +++ b/src/OpenSearch/Namespaces/ClusterNamespace.php @@ -281,16 +281,16 @@ public function getWeightedRouting(array $params = []) * $params['awareness_attribute'] = (string) The awareness attribute for which the health is required. * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node. * $params['expand_wildcards'] = (any) Whether to expand wildcard expression to concrete indices that are open, closed or both. - * $params['level'] = (enum) Can be one of cluster, indices or shards. Controls the details level of the health information returned. (Options = cluster,indices,shards,awareness_attributes) + * $params['level'] = (enum) Can be one of cluster, indices or shards. Controls the details level of the health information returned. (Options = awareness_attributes,cluster,indices,shards) * $params['local'] = (boolean) If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. (Default = false) * $params['master_timeout'] = (string) Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. * $params['timeout'] = (string) Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. * $params['wait_for_active_shards'] = (any) A number controlling to how many active shards to wait for, all to wait for all shards in the cluster to be active, or 0 to not wait. - * $params['wait_for_events'] = (enum) Can be one of immediate, urgent, high, normal, low, languid. Wait until all currently queued events with the given priority are processed. (Options = immediate,urgent,high,normal,low,languid) + * $params['wait_for_events'] = (enum) Can be one of immediate, urgent, high, normal, low, languid. Wait until all currently queued events with the given priority are processed. (Options = high,immediate,languid,low,normal,urgent) * $params['wait_for_no_initializing_shards'] = (boolean) A boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard initializations. Defaults to false, which means it will not wait for initializing shards. * $params['wait_for_no_relocating_shards'] = (boolean) A boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard relocations. Defaults to false, which means it will not wait for relocating shards. * $params['wait_for_nodes'] = (any) The request waits until the specified number N of nodes is available. It also accepts >=N, <=N, >N and yellow > red. By default, will not wait for any status. (Options = green,yellow,red) + * $params['wait_for_status'] = (enum) One of green, yellow or red. Will wait (until the timeout provided) until the status of the cluster changes to the one provided or better, i.e. green > yellow > red. By default, will not wait for any status. (Options = green,red,yellow) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -360,7 +360,7 @@ public function postVotingConfigExclusions(array $params = []) /** * Creates or updates a component template. * - * $params['name'] = (string) Name of the component template to create. OpenSearch includes the following built-in component templates: `logs-mappings`; 'logs-settings`; `metrics-mappings`; `metrics-settings`;`synthetics-mapping`; `synthetics-settings`. OpenSearch Agent uses these templates to configure backing indices for its data streams. If you use OpenSearch Agent and want to overwrite one of these templates, set the `version` for your replacement template higher than the current version. If you don’t use OpenSearch Agent and want to disable all built-in component and index templates, set `stack.templates.enabled` to `false` using the cluster update settings API. + * $params['name'] = (string) Name of the component template to create. OpenSearch includes the following built-in component templates: `logs-mappings`; 'logs-settings`; `metrics-mappings`; `metrics-settings`;`synthetics-mapping`; `synthetics-settings`. OpenSearch Agent uses these templates to configure backing indices for its data streams. If you use OpenSearch Agent and want to overwrite one of these templates, set the `version` for your replacement template higher than the current version. If you don't use OpenSearch Agent and want to disable all built-in component and index templates, set `stack.templates.enabled` to `false` using the cluster update settings API. * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node. * $params['create'] = (boolean) If `true`, this request cannot replace or update existing component templates. (Default = false) * $params['master_timeout'] = (string) Period to wait for a connection to the master node.If no response is received before the timeout expires, the request fails and returns an error. @@ -559,7 +559,7 @@ public function state(array $params = []) * * $params['node_id'] = (array) Comma-separated list of node filters used to limit returned information. Defaults to all nodes in the cluster. * $params['flat_settings'] = (boolean) If `true`, returns settings in flat format. (Default = false) - * $params['timeout'] = (string) Period to wait for each node to respond.If a node does not respond before its timeout expires, the response does not include its stats.However, timed out nodes are included in the response’s `_nodes.failed` property. Defaults to no timeout. + * $params['timeout'] = (string) Period to wait for each node to respond.If a node does not respond before its timeout expires, the response does not include its stats.However, timed out nodes are included in the response's `_nodes.failed` property. Defaults to no timeout. * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. diff --git a/src/OpenSearch/Namespaces/IndicesNamespace.php b/src/OpenSearch/Namespaces/IndicesNamespace.php index 47396725..65d41c1b 100644 --- a/src/OpenSearch/Namespaces/IndicesNamespace.php +++ b/src/OpenSearch/Namespaces/IndicesNamespace.php @@ -98,6 +98,7 @@ public function analyze(array $params = []) * $params['expand_wildcards'] = (any) Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma-separated values, such as `open,hidden`.Valid values are: `all`, `open`, `closed`, `hidden`, `none`. * $params['fielddata'] = (boolean) If `true`, clears the fields cache.Use the `fields` parameter to clear the cache of specific fields only. * $params['fields'] = (any) Comma-separated list of field names used to limit the `fielddata` parameter. + * $params['file'] = (boolean) If true, clears the unused entries from the file cache on nodes with the Search role. (Default = false) * $params['ignore_unavailable'] = (boolean) If `false`, the request returns an error if it targets a missing or closed index. * $params['query'] = (boolean) If `true`, clears the query cache. * $params['request'] = (boolean) If `true`, clears the request cache. @@ -902,7 +903,7 @@ public function open(array $params = []) * Creates or updates an alias. * * $params['index'] = (array) Comma-separated list of data streams or indices to add. Supports wildcards (`*`). Wildcard patterns that match both data streams and indices return an error. (Required) - * $params['name'] = (string) Alias to update. If the alias doesn’t exist, the request creates it. Index alias names support date math. (Required) + * $params['name'] = (string) Alias to update. If the alias doesn't exist, the request creates it. Index alias names support date math. (Required) * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node. * $params['master_timeout'] = (string) Period to wait for a connection to the master node.If no response is received before the timeout expires, the request fails and returns an error. * $params['timeout'] = (string) Period to wait for a response.If no response is received before the timeout expires, the request fails and returns an error. diff --git a/src/OpenSearch/Namespaces/IngestNamespace.php b/src/OpenSearch/Namespaces/IngestNamespace.php index 927158c5..d217dc47 100644 --- a/src/OpenSearch/Namespaces/IngestNamespace.php +++ b/src/OpenSearch/Namespaces/IngestNamespace.php @@ -136,7 +136,7 @@ public function putPipeline(array $params = []) /** * Allows to simulate a pipeline with example documents. * - * $params['id'] = (string) Pipeline to test. If you don’t specify a `pipeline` in the request body, this parameter is required. + * $params['id'] = (string) Pipeline to test. If you don't specify a `pipeline` in the request body, this parameter is required. * $params['verbose'] = (boolean) If `true`, the response includes output data for each processor in the executed pipeline. (Default = false) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. diff --git a/src/OpenSearch/Namespaces/KnnNamespace.php b/src/OpenSearch/Namespaces/KnnNamespace.php index 2d094fab..9406836f 100644 --- a/src/OpenSearch/Namespaces/KnnNamespace.php +++ b/src/OpenSearch/Namespaces/KnnNamespace.php @@ -101,14 +101,14 @@ public function getModel(array $params = []) * $params['rest_total_hits_as_int'] = (boolean) Indicates whether hits.total should be rendered as an integer or an object in the rest search response. (Default = false) * $params['routing'] = (array) Comma-separated list of specific routing values. * $params['scroll'] = (string) Specify how long a consistent view of the index should be maintained for scrolled search. - * $params['search_type'] = (enum) Search operation type. (Options = query_then_fetch,dfs_query_then_fetch) + * $params['search_type'] = (enum) Search operation type. (Options = dfs_query_then_fetch,query_then_fetch) * $params['seq_no_primary_term'] = (boolean) Specify whether to return sequence number and primary term of the last modification of each hit. * $params['size'] = (integer) Number of hits to return. (Default = 10) * $params['sort'] = (array) Comma-separated list of : pairs. * $params['stats'] = (array) Specific 'tag' of the request for logging and statistical purposes. * $params['stored_fields'] = (array) Comma-separated list of stored fields to return. * $params['suggest_field'] = (string) Specify which field to use for suggestions. - * $params['suggest_mode'] = (enum) Specify suggest mode. (Options = missing,popular,always) + * $params['suggest_mode'] = (enum) Specify suggest mode. (Options = always,missing,popular) * $params['suggest_size'] = (integer) How many suggestions to return in response. * $params['suggest_text'] = (string) The source text for which the suggestions should be returned. * $params['terminate_after'] = (integer) The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. diff --git a/src/OpenSearch/Namespaces/MachineLearningNamespace.php b/src/OpenSearch/Namespaces/MlNamespace.php similarity index 55% rename from src/OpenSearch/Namespaces/MachineLearningNamespace.php rename to src/OpenSearch/Namespaces/MlNamespace.php index d4989b6a..c89c35e8 100644 --- a/src/OpenSearch/Namespaces/MachineLearningNamespace.php +++ b/src/OpenSearch/Namespaces/MlNamespace.php @@ -3,12 +3,14 @@ declare(strict_types=1); /** - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. */ namespace OpenSearch\Namespaces; @@ -16,232 +18,263 @@ use OpenSearch\Namespaces\AbstractNamespace; /** - * Class MachineLearningNamespace - * - * This class implements common functionality from the - * ML Commons API. Please refer to that documentation - * for more details about each API operation. + * Class MlNamespace * - * @link https://opensearch.org/docs/latest/ml-commons-plugin/api/index/ + * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ -class MachineLearningNamespace extends AbstractNamespace +class MlNamespace extends AbstractNamespace { /** - * $params['body'] = (string) The body of the request (Required) + * Deletes a model. * - * @param array $params Associative array of parameters + * $params['id'] = (string) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * + * @param array $params Associative array of parameters * @return array - * The response. */ - public function createConnector(array $params = []): array + public function deleteModel(array $params = []) { - $body = $this->extractArgument($params, 'body'); + $id = $this->extractArgument($params, 'id'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\Connectors\CreateConnector'); + $endpoint = $endpointBuilder('Ml\DeleteModel'); $endpoint->setParams($params); - $endpoint->setBody($body); + $endpoint->setId($id); return $this->performRequest($endpoint); } - /** - * $params['id'] = (string) The id of the connector (Required) + * Deletes a model group. * - * @param array $params Associative array of parameters + * $params['id'] = (string) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * + * @param array $params Associative array of parameters * @return array - * The response. */ - public function getConnector(array $params = []): array + public function deleteModelGroup(array $params = []) { $id = $this->extractArgument($params, 'id'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\Connectors\GetConnector'); + $endpoint = $endpointBuilder('Ml\DeleteModelGroup'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** - * $params['body'] = (string) The body of the request + * Retrieves a model group. * - * @param array $params Associative array of parameters + * $params['model_group_id'] = (string) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * + * @param array $params Associative array of parameters * @return array - * The response. */ - public function getConnectors(array $params = []): array + public function getModelGroup(array $params = []) { - if (!isset($params['body'])) { - $params['body'] = [ - 'query' => [ - 'match_all' => new \StdClass(), - ], - 'size' => 1000, - ]; - } - $body = $this->extractArgument($params, 'body'); + $model_group_id = $this->extractArgument($params, 'model_group_id'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\Connectors\GetConnectors'); - $endpoint->setBody($body); + $endpoint = $endpointBuilder('Ml\GetModelGroup'); + $endpoint->setParams($params); + $endpoint->setModelGroupId($model_group_id); return $this->performRequest($endpoint); } - /** - * $params['id'] = (string) The id of the connector (Required) + * Retrieves a task. * - * @param array $params Associative array of parameters + * $params['id'] = (string) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * + * @param array $params Associative array of parameters * @return array - * The response. */ - public function deleteConnector(array $params = []): array + public function getTask(array $params = []) { $id = $this->extractArgument($params, 'id'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\Connectors\DeleteConnector'); + $endpoint = $endpointBuilder('Ml\GetTask'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** - * $params['body'] = (string) The body of the request (Required) + * Registers a model. * - * @param array $params Associative array of parameters + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * + * @param array $params Associative array of parameters * @return array - * The response. */ - public function registerModelGroup(array $params = []): array + public function registerModel(array $params = []) { $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\ModelGroups\RegisterModelGroup'); + $endpoint = $endpointBuilder('Ml\RegisterModel'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** - * $params['body'] = (string) The body of the request + * Registers a model group. * - * @param array $params Associative array of parameters + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * + * @param array $params Associative array of parameters * @return array - * The response. */ - public function getModelGroups(array $params = []): array + public function registerModelGroup(array $params = []) { - if (!isset($params['body'])) { - $params['body'] = [ - 'query' => [ - 'match_all' => new \StdClass(), - ], - 'size' => 1000, - ]; - } $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\ModelGroups\GetModelGroups'); + $endpoint = $endpointBuilder('Ml\RegisterModelGroup'); + $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** + * Searches for models. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function searchModels(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\SearchModels'); + $endpoint->setParams($params); + $endpoint->setBody($body); + return $this->performRequest($endpoint); + } /** - * $params['id'] = (string) The id of the model group (Required) - * $params['body'] = (array) The body of the request (Required) + * $params['body'] = (string) The body of the request (Required) * * @param array $params Associative array of parameters * * @return array * The response. */ - public function updateModelGroup(array $params = []): array + public function createConnector(array $params = []): array { - $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\ModelGroups\UpdateModelGroup'); + $endpoint = $endpointBuilder('Ml\CreateConnector'); $endpoint->setParams($params); $endpoint->setBody($body); - $endpoint->setId($id); return $this->performRequest($endpoint); } - /** - * $params['id'] = (string) The id of the model group (Required) + * $params['id'] = (string) The id of the connector (Required) * * @param array $params Associative array of parameters * * @return array * The response. */ - public function deleteModelGroup(array $params = []): array + public function deleteConnector(array $params = []): array { $id = $this->extractArgument($params, 'id'); $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\ModelGroups\DeleteModelGroup'); + $endpoint = $endpointBuilder('Ml\DeleteConnector'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** - * $params['body'] = (string) The body of the request (Required) + * $params['id'] = (string) The id of the model (Required) + * $params['body'] = (string) The body of the request * * @param array $params Associative array of parameters * * @return array * The response. */ - public function registerModel(array $params = []): array + public function deployModel(array $params = []): array { + $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\Models\RegisterModel'); + $endpoint = $endpointBuilder('Ml\DeployModel'); $endpoint->setParams($params); - $endpoint->setBody($body); + $endpoint->setId($id); + if ($body) { + $endpoint->setBody($body); + } return $this->performRequest($endpoint); } - /** - * $params['id'] = (string) The id of the model (Required) + * $params['id'] = (string) The id of the connector (Required) * * @param array $params Associative array of parameters * * @return array * The response. */ - public function getModel(array $params = []): array + public function getConnector(array $params = []): array { $id = $this->extractArgument($params, 'id'); $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\Models\GetModel'); + $endpoint = $endpointBuilder('Ml\GetConnector'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** - * $params['body'] = (array) The body of the request + * $params['body'] = (string) The body of the request * * @param array $params Associative array of parameters * * @return array * The response. */ - public function getModels(array $params = []): array + public function getConnectors(array $params = []): array { if (!isset($params['body'])) { $params['body'] = [ @@ -253,80 +286,92 @@ public function getModels(array $params = []): array } $body = $this->extractArgument($params, 'body'); $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\Models\GetModels'); - $endpoint->setParams($params); + $endpoint = $endpointBuilder('Ml\GetConnectors'); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** - * $params['id'] = (string) The id of the model (Required) - * $params['body'] = (string) The body of the request + * $params['body'] = (string) The body of the request * * @param array $params Associative array of parameters * * @return array * The response. */ - public function deployModel(array $params = []): array + public function getModelGroups(array $params = []): array { - $id = $this->extractArgument($params, 'id'); + if (!isset($params['body'])) { + $params['body'] = [ + 'query' => [ + 'match_all' => new \StdClass(), + ], + 'size' => 1000, + ]; + } $body = $this->extractArgument($params, 'body'); $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\Models\DeployModel'); - $endpoint->setParams($params); - $endpoint->setId($id); - if ($body) { - $endpoint->setBody($body); - } + $endpoint = $endpointBuilder('Ml\GetModelGroups'); + $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * $params['id'] = (string) The id of the model (Required) - * $params['body'] = (string) The body of the request * * @param array $params Associative array of parameters * * @return array * The response. */ - public function undeployModel(array $params = []): array + public function getModel(array $params = []): array { $id = $this->extractArgument($params, 'id'); - $body = $this->extractArgument($params, 'body'); $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\Models\UndeployModel'); + $endpoint = $endpointBuilder('Ml\GetModel'); $endpoint->setParams($params); $endpoint->setId($id); - if ($body) { - $endpoint->setBody($body); - } return $this->performRequest($endpoint); } + /** + * Proxy function to getModels() to prevent BC break. + * This API will be removed in a future version. Use 'searchModels' API instead. + */ + public function getModels(array $params = []) + { + if (!isset($params['body'])) { + $params['body'] = [ + 'query' => [ + 'match_all' => new \StdClass(), + ], + 'size' => 1000, + ]; + } + return $this->searchModels($params); + } /** * $params['id'] = (string) The id of the model (Required) + * $params['body'] = (string) The body of the request * * @param array $params Associative array of parameters * * @return array * The response. */ - public function deleteModel(array $params = []): array + public function predict(array $params = []): array { $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\Models\DeleteModel'); + $endpoint = $endpointBuilder('Ml\Predict'); $endpoint->setParams($params); $endpoint->setId($id); + $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * $params['id'] = (string) The id of the model (Required) * $params['body'] = (string) The body of the request @@ -336,36 +381,39 @@ public function deleteModel(array $params = []): array * @return array * The response. */ - public function predict(array $params = []): array + public function undeployModel(array $params = []): array { $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\Models\Predict'); + $endpoint = $endpointBuilder('Ml\UndeployModel'); $endpoint->setParams($params); $endpoint->setId($id); - $endpoint->setBody($body); + if ($body) { + $endpoint->setBody($body); + } return $this->performRequest($endpoint); } - /** - * $params['id'] = (string) The id of the task (Required) + * $params['id'] = (string) The id of the model group (Required) + * $params['body'] = (array) The body of the request (Required) * * @param array $params Associative array of parameters * * @return array * The response. */ - public function getTask(array $params = []): array + public function updateModelGroup(array $params = []): array { $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MachineLearning\Tasks\GetTask'); + $endpoint = $endpointBuilder('Ml\UpdateModelGroup'); $endpoint->setParams($params); + $endpoint->setBody($body); $endpoint->setId($id); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/NodesNamespace.php b/src/OpenSearch/Namespaces/NodesNamespace.php index 6946b1de..e9b39043 100644 --- a/src/OpenSearch/Namespaces/NodesNamespace.php +++ b/src/OpenSearch/Namespaces/NodesNamespace.php @@ -39,7 +39,7 @@ class NodesNamespace extends AbstractNamespace * $params['snapshots'] = (integer) Number of samples of thread stacktrace. (Default = 10) * $params['threads'] = (integer) Specify the number of threads to provide information for. (Default = 3) * $params['timeout'] = (string) Operation timeout. - * $params['type'] = (enum) The type to sample. (Options = cpu,wait,block) + * $params['type'] = (enum) The type to sample. (Options = block,cpu,wait) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. diff --git a/src/OpenSearch/Namespaces/NotificationsNamespace.php b/src/OpenSearch/Namespaces/NotificationsNamespace.php index 756dd2a0..2022c024 100644 --- a/src/OpenSearch/Namespaces/NotificationsNamespace.php +++ b/src/OpenSearch/Namespaces/NotificationsNamespace.php @@ -122,7 +122,7 @@ public function getConfig(array $params = []) * * $params['chime.url'] = (string) * $params['chime.url.keyword'] = (string) - * $params['config_type'] = (enum) Type of notification configuration. (Options = slack,chime,microsoft_teams,webhook,email,sns,ses_account,smtp_account,email_group) + * $params['config_type'] = (enum) Type of notification configuration. (Options = chime,email,email_group,microsoft_teams,ses_account,slack,smtp_account,sns,webhook) * $params['created_time_ms'] = (integer) * $params['description'] = (string) * $params['description.keyword'] = (string) diff --git a/src/OpenSearch/Namespaces/TasksNamespace.php b/src/OpenSearch/Namespaces/TasksNamespace.php index 2292ed72..6bdb239b 100644 --- a/src/OpenSearch/Namespaces/TasksNamespace.php +++ b/src/OpenSearch/Namespaces/TasksNamespace.php @@ -89,7 +89,7 @@ public function get(array $params = []) * * $params['actions'] = (any) Comma-separated list or wildcard expression of actions used to limit the request. * $params['detailed'] = (boolean) If `true`, the response includes detailed information about shard recoveries. (Default = false) - * $params['group_by'] = (enum) Key used to group tasks in the response. (Options = nodes,parents,none) + * $params['group_by'] = (enum) Key used to group tasks in the response. (Options = nodes,none,parents) * $params['nodes'] = (array) Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes. * $params['parent_task_id'] = (string) Parent task ID used to limit returned information. To return all tasks, omit this parameter or use a value of `-1`. * $params['timeout'] = (string) Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. diff --git a/src/OpenSearch/Namespaces/TransformsNamespace.php b/src/OpenSearch/Namespaces/TransformsNamespace.php index fa124ad5..8612685d 100644 --- a/src/OpenSearch/Namespaces/TransformsNamespace.php +++ b/src/OpenSearch/Namespaces/TransformsNamespace.php @@ -147,10 +147,10 @@ public function put(array $params = []) /** * Returns the details of all transform jobs. * - * $params['from'] = (number) The starting transform to return. Default is 0. + * $params['from'] = (number) The starting transform to return. Default is `0`. * $params['search'] = (string) The search term to use to filter results. - * $params['size'] = (number) Specifies the number of transforms to return. Default is 10. - * $params['sortDirection'] = (string) Specifies the direction to sort results in. Can be ASC or DESC. Default is ASC. + * $params['size'] = (number) Specifies the number of transforms to return. Default is `10`. + * $params['sortDirection'] = (string) Specifies the direction to sort results in. Can be `ASC` or `DESC`. Default is `ASC`. * $params['sortField'] = (string) The field to sort results with. * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. diff --git a/tests/Endpoints/MlNamespaceIntegrationTest.php b/tests/Endpoints/MlNamespaceIntegrationTest.php new file mode 100644 index 00000000..61962d88 --- /dev/null +++ b/tests/Endpoints/MlNamespaceIntegrationTest.php @@ -0,0 +1,76 @@ +markTestSkipped('Ml plugin tests require OpenSearch >= 2.8.0'); + } + + $modelGroupResponse = $client->ml()->registerModelGroup([ + 'body' => [ + 'name' => 'openai_model_group', + 'description' => 'Group containing models for OpenAI', + ], + ]); + $this->assertNotEmpty($modelGroupResponse['model_group_id']); + } + + public function testgetModels() + { + $client = Utility::getClient(); + + if (!Utility::isOpenSearchVersionAtLeast($client, '2.12.0') || !Utility::isOpenSearchVersionAtmost($client, '2.x')) { + $this->markTestSkipped('Ml plugin tests require OpenSearch >= 2.12.0'); + } + + $modelGroupResponse = $client->ml()->getModels(); + $this->assertNotEmpty($modelGroupResponse['hits']); + } + + public function testsearchModels() + { + $client = Utility::getClient(); + + if (!Utility::isOpenSearchVersionAtLeast($client, '2.12.0') || !Utility::isOpenSearchVersionAtmost($client, '2.x')) { + $this->markTestSkipped('Ml plugin tests require OpenSearch >= 2.12.0'); + } + + $modelGroupResponse = $client->ml()->searchModels([ + 'body' => [ + 'query' => [ + 'match_all' => new \StdClass(), + ], + 'size' => 1000, + ], + ]); + $this->assertNotEmpty($modelGroupResponse['hits']); + } +} diff --git a/tests/Namespaces/MachineLearningNamespaceTest.php b/tests/Namespaces/MachineLearningNamespaceTest.php index 4b83a3d1..5101983c 100644 --- a/tests/Namespaces/MachineLearningNamespaceTest.php +++ b/tests/Namespaces/MachineLearningNamespaceTest.php @@ -2,24 +2,24 @@ namespace OpenSearch\Tests\Namespaces; -use OpenSearch\Endpoints\MachineLearning\Connectors\CreateConnector; -use OpenSearch\Endpoints\MachineLearning\Connectors\DeleteConnector; -use OpenSearch\Endpoints\MachineLearning\Connectors\GetConnector; -use OpenSearch\Endpoints\MachineLearning\Connectors\GetConnectors; -use OpenSearch\Endpoints\MachineLearning\ModelGroups\DeleteModelGroup; -use OpenSearch\Endpoints\MachineLearning\ModelGroups\GetModelGroups; -use OpenSearch\Endpoints\MachineLearning\ModelGroups\RegisterModelGroup; -use OpenSearch\Endpoints\MachineLearning\ModelGroups\UpdateModelGroup; -use OpenSearch\Endpoints\MachineLearning\Models\DeleteModel; -use OpenSearch\Endpoints\MachineLearning\Models\DeployModel; -use OpenSearch\Endpoints\MachineLearning\Models\GetModel; -use OpenSearch\Endpoints\MachineLearning\Models\GetModels; -use OpenSearch\Endpoints\MachineLearning\Models\Predict; -use OpenSearch\Endpoints\MachineLearning\Models\RegisterModel; -use OpenSearch\Endpoints\MachineLearning\Models\UndeployModel; -use OpenSearch\Endpoints\MachineLearning\Tasks\GetTask; +use OpenSearch\Endpoints\Ml\CreateConnector; +use OpenSearch\Endpoints\Ml\DeleteConnector; +use OpenSearch\Endpoints\Ml\GetConnector; +use OpenSearch\Endpoints\Ml\GetConnectors; +use OpenSearch\Endpoints\Ml\DeleteModelGroup; +use OpenSearch\Endpoints\Ml\GetModelGroups; +use OpenSearch\Endpoints\Ml\RegisterModelGroup; +use OpenSearch\Endpoints\Ml\UpdateModelGroup; +use OpenSearch\Endpoints\Ml\DeleteModel; +use OpenSearch\Endpoints\Ml\DeployModel; +use OpenSearch\Endpoints\Ml\GetModel; +use OpenSearch\Endpoints\Ml\SearchModels; +use OpenSearch\Endpoints\Ml\Predict; +use OpenSearch\Endpoints\Ml\RegisterModel; +use OpenSearch\Endpoints\Ml\UndeployModel; +use OpenSearch\Endpoints\Ml\GetTask; use OpenSearch\Endpoints\Sql\Query; -use OpenSearch\Namespaces\MachineLearningNamespace; +use OpenSearch\Namespaces\MlNamespace; use OpenSearch\Namespaces\SqlNamespace; use OpenSearch\Transport; use PHPUnit\Framework\TestCase; @@ -32,7 +32,7 @@ * this file be licensed under the Apache-2.0 license or a * compatible open source license. */ -class MachineLearningNamespaceTest extends TestCase +class MlNamespaceTest extends TestCase { public function testCreatingConnector(): void { @@ -51,7 +51,7 @@ public function testCreatingConnector(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->createConnector([ + (new MlNamespace($transport, $func))->createConnector([ 'body' => [ 'foo' => 'bar', ], @@ -73,7 +73,7 @@ public function testGetConnector(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->getConnector([ + (new MlNamespace($transport, $func))->getConnector([ 'id' => 'foobar' ]); } @@ -98,7 +98,7 @@ public function testGetConnectors(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->getConnectors([ + (new MlNamespace($transport, $func))->getConnectors([ 'body' => [ 'query' => [ 'match_all' => new \StdClass(), @@ -123,7 +123,7 @@ public function testDeleteConnector(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->deleteConnector([ + (new MlNamespace($transport, $func))->deleteConnector([ 'id' => 'foobar' ]); } @@ -145,7 +145,7 @@ public function testRegisterModelGroup(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->registerModelGroup([ + (new MlNamespace($transport, $func))->registerModelGroup([ 'body' => [ 'foo' => 'bar', ], @@ -172,7 +172,7 @@ public function testGetModelGroups(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->getModelGroups([ + (new MlNamespace($transport, $func))->getModelGroups([ 'body' => [ 'query' => [ 'match_all' => new \StdClass(), @@ -202,7 +202,7 @@ public function testUpdateModelGroup(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->updateModelGroup([ + (new MlNamespace($transport, $func))->updateModelGroup([ 'id' => 'foobar', 'body' => [ 'query' => [ @@ -228,7 +228,7 @@ public function testDeleteModelGroup(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->deleteModelGroup([ + (new MlNamespace($transport, $func))->deleteModelGroup([ 'id' => 'foobar' ]); } @@ -250,7 +250,7 @@ public function testRegisterModel(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->registerModel([ + (new MlNamespace($transport, $func))->registerModel([ 'body' => [ 'foo' => 'bar', ], @@ -272,22 +272,22 @@ public function testGetModel(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->getModel([ + (new MlNamespace($transport, $func))->getModel([ 'id' => 'foobar', ]); } - public function testGetModels(): void + public function testSearchModels(): void { $func = static function () { - return new GetModels(); + return new SearchModels(); }; $transport = $this->createMock(Transport::class); $transport->method('performRequest') - ->with('POST', '/_plugins/_ml/models/_search', [], [ + ->with('GET', '/_plugins/_ml/models/_search', [], [ 'query' => [ 'match_all' => new \StdClass(), ], @@ -297,7 +297,7 @@ public function testGetModels(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->getModels([ + (new MlNamespace($transport, $func))->searchModels([ 'body' => [ 'query' => [ 'match_all' => new \StdClass(), @@ -322,7 +322,7 @@ public function testDeployModel(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->deployModel([ + (new MlNamespace($transport, $func))->deployModel([ 'id' => 'foobar', ]); } @@ -342,7 +342,7 @@ public function testUnDeployModel(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->undeployModel([ + (new MlNamespace($transport, $func))->undeployModel([ 'id' => 'foobar', ]); } @@ -362,7 +362,7 @@ public function testDeleteModel(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->deleteModel([ + (new MlNamespace($transport, $func))->deleteModel([ 'id' => 'foobar', ]); } @@ -384,7 +384,7 @@ public function testPredict(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->predict([ + (new MlNamespace($transport, $func))->predict([ 'id' => 'foobar', 'body' => [ 'foo' => 'bar', @@ -407,7 +407,7 @@ public function testGetTask(): void $transport->method('resultOrFuture') ->willReturn([]); - (new MachineLearningNamespace($transport, $func))->getTask([ + (new MlNamespace($transport, $func))->getTask([ 'id' => 'foobar', ]); } diff --git a/tests/Utility.php b/tests/Utility.php index 9c3bd7a0..8775829a 100644 --- a/tests/Utility.php +++ b/tests/Utility.php @@ -82,6 +82,20 @@ public static function isOpenSearchVersionAtLeast(Client $client, string $versio return version_compare($versionNumber, $version) >= 0; } + /** + * Check if cluster is OpenSearch and version is less than the specified version. + */ + public static function isOpenSearchVersionAtMost(Client $client, string $version): bool + { + $versionInfo = self::getVersion($client); + $distribution = $versionInfo['distribution'] ?? null; + if ($distribution !== 'opensearch') { + return false; + } + $versionNumber = $versionInfo['number']; + return version_compare($versionNumber, $version, '<'); + } + /** * Check if cluster is Elasticsearch and version is greater than or equal to specified version. */ diff --git a/util/EndpointProxies/ml/createConnectorProxy.php b/util/EndpointProxies/ml/createConnectorProxy.php new file mode 100644 index 00000000..c9841cfc --- /dev/null +++ b/util/EndpointProxies/ml/createConnectorProxy.php @@ -0,0 +1,23 @@ +extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\CreateConnector'); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } +EOD; diff --git a/util/EndpointProxies/ml/deleteConnectorProxy.php b/util/EndpointProxies/ml/deleteConnectorProxy.php new file mode 100644 index 00000000..4bd179a4 --- /dev/null +++ b/util/EndpointProxies/ml/deleteConnectorProxy.php @@ -0,0 +1,23 @@ +extractArgument($params, 'id'); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\DeleteConnector'); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } +EOD; diff --git a/util/EndpointProxies/ml/deployModelProxy.php b/util/EndpointProxies/ml/deployModelProxy.php new file mode 100644 index 00000000..3d3d5810 --- /dev/null +++ b/util/EndpointProxies/ml/deployModelProxy.php @@ -0,0 +1,28 @@ +extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\DeployModel'); + $endpoint->setParams($params); + $endpoint->setId($id); + if ($body) { + $endpoint->setBody($body); + } + + return $this->performRequest($endpoint); + } +EOD; diff --git a/util/EndpointProxies/ml/getConnectorProxy.php b/util/EndpointProxies/ml/getConnectorProxy.php new file mode 100644 index 00000000..5988c755 --- /dev/null +++ b/util/EndpointProxies/ml/getConnectorProxy.php @@ -0,0 +1,23 @@ +extractArgument($params, 'id'); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\GetConnector'); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } +EOD; diff --git a/util/EndpointProxies/ml/getConnectorsProxy.php b/util/EndpointProxies/ml/getConnectorsProxy.php new file mode 100644 index 00000000..55e03fa8 --- /dev/null +++ b/util/EndpointProxies/ml/getConnectorsProxy.php @@ -0,0 +1,30 @@ + [ + 'match_all' => new \StdClass(), + ], + 'size' => 1000, + ]; + } + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\GetConnectors'); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } +EOD; diff --git a/util/EndpointProxies/ml/getModelGroupsProxy.php b/util/EndpointProxies/ml/getModelGroupsProxy.php new file mode 100644 index 00000000..8d7c6576 --- /dev/null +++ b/util/EndpointProxies/ml/getModelGroupsProxy.php @@ -0,0 +1,30 @@ + [ + 'match_all' => new \StdClass(), + ], + 'size' => 1000, + ]; + } + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\GetModelGroups'); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } +EOD; diff --git a/util/EndpointProxies/ml/getModelProxy.php b/util/EndpointProxies/ml/getModelProxy.php new file mode 100644 index 00000000..39e51495 --- /dev/null +++ b/util/EndpointProxies/ml/getModelProxy.php @@ -0,0 +1,23 @@ +extractArgument($params, 'id'); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\GetModel'); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } +EOD; diff --git a/util/EndpointProxies/ml/getModelsProxy.php b/util/EndpointProxies/ml/getModelsProxy.php new file mode 100644 index 00000000..edf0adc2 --- /dev/null +++ b/util/EndpointProxies/ml/getModelsProxy.php @@ -0,0 +1,22 @@ + [ + 'match_all' => new \StdClass(), + ], + 'size' => 1000, + ]; + } + + return $this->searchModels($params); + } +EOD; diff --git a/util/EndpointProxies/ml/predictProxy.php b/util/EndpointProxies/ml/predictProxy.php new file mode 100644 index 00000000..e9b275fa --- /dev/null +++ b/util/EndpointProxies/ml/predictProxy.php @@ -0,0 +1,26 @@ +extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\Predict'); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } +EOD; diff --git a/util/EndpointProxies/ml/undeployModelProxy.php b/util/EndpointProxies/ml/undeployModelProxy.php new file mode 100644 index 00000000..ae22f68f --- /dev/null +++ b/util/EndpointProxies/ml/undeployModelProxy.php @@ -0,0 +1,28 @@ +extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\UndeployModel'); + $endpoint->setParams($params); + $endpoint->setId($id); + if ($body) { + $endpoint->setBody($body); + } + + return $this->performRequest($endpoint); + } +EOD; diff --git a/util/EndpointProxies/ml/updateModelGroupProxy.php b/util/EndpointProxies/ml/updateModelGroupProxy.php new file mode 100644 index 00000000..166f048b --- /dev/null +++ b/util/EndpointProxies/ml/updateModelGroupProxy.php @@ -0,0 +1,26 @@ +extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\UpdateModelGroup'); + $endpoint->setParams($params); + $endpoint->setBody($body); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } +EOD; diff --git a/util/GenerateEndpoints.php b/util/GenerateEndpoints.php index 9a121d08..04833c44 100644 --- a/util/GenerateEndpoints.php +++ b/util/GenerateEndpoints.php @@ -180,6 +180,21 @@ $parts_dict['deprecated'] = $part['deprecated']; } + # To prevent breaking change, replaced below path parameter to 'id' + + $operationGroups = [ + 'ml.delete_model' => 'model_id', + 'ml.delete_model_group' => 'model_group_id', + 'ml.get_task' => 'task_id' + ]; + + foreach ($operationGroups as $group => $name) { + if ($endpoint['x-operation-group'] === $group && $part['name'] === $name) { + $part['name'] = 'id'; + break; + } + } + $parts_new[$part['name']] = $parts_dict; } if (!empty($parts_new)) { @@ -289,6 +304,12 @@ $api['headers'] = ['accept' => ['application/json']]; } + foreach ($operationGroups as $group => $name) { + if ($key === $group) { + $path = str_replace($name, 'id', $path); + } + } + $path_data = ['path' => $path, 'methods' => $methods]; if (!empty($deprecated_path_dict)) { @@ -508,7 +529,10 @@ function isValidPhpSyntax(string $filename): bool function Patch_Endpoints() { $patchEndpoints = ['AsyncSearch', 'SearchableSnapshots', 'Ssl', 'Sql', - 'DataFrameTransformDeprecated', 'Monitoring', 'Indices/RefreshSearchAnalyzers' ]; + 'DataFrameTransformDeprecated', 'Monitoring', 'Indices/RefreshSearchAnalyzers', + 'Ml/CreateConnector', 'Ml/DeleteConnector', 'Ml/GetConnector', 'Ml/GetConnectors', + 'Ml/GetModelGroups', 'Ml/UpdateModelGroup', 'Ml/DeployModel', 'Ml/GetModel', 'Ml/Predict', + 'Ml/UndeployModel']; $outputDir = __DIR__ . "/output"; $destDir = __DIR__ . "/../src/OpenSearch";