-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
Signed-off-by: dblock <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,31 +49,6 @@ public function close(array $params = []) | |
|
||
return $this->performRequest($endpoint); | ||
} | ||
/** | ||
* Shows how a query is executed against OpenSearch. | ||
* | ||
* $params['format'] = (string) A short version of the Accept header, e.g. json, yaml. | ||
* $params['sanitize'] = (boolean) Specifies whether to escape special characters in the results (Default = true) | ||
* $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 explain(array $params = []) | ||
{ | ||
$body = $this->extractArgument($params, 'body'); | ||
|
||
$endpointBuilder = $this->endpoints; | ||
$endpoint = $endpointBuilder('Sql\Explain'); | ||
$endpoint->setParams($params); | ||
$endpoint->setBody($body); | ||
|
||
return $this->performRequest($endpoint); | ||
} | ||
/** | ||
* Collect metrics for the plugin within the interval. | ||
* | ||
|
@@ -121,31 +96,6 @@ public function postStats(array $params = []) | |
|
||
return $this->performRequest($endpoint); | ||
} | ||
/** | ||
* Send a SQL/PPL query to the SQL plugin. | ||
* | ||
* $params['format'] = (string) A short version of the Accept header, e.g. json, yaml. | ||
* $params['sanitize'] = (boolean) Specifies whether to escape special characters in the results (Default = true) | ||
* $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 query(array $params = []) | ||
{ | ||
$body = $this->extractArgument($params, 'body'); | ||
|
||
$endpointBuilder = $this->endpoints; | ||
$endpoint = $endpointBuilder('Sql\Query'); | ||
$endpoint->setParams($params); | ||
$endpoint->setBody($body); | ||
|
||
return $this->performRequest($endpoint); | ||
} | ||
/** | ||
* Adds SQL settings to the standard OpenSearch cluster settings. | ||
* | ||
|
@@ -170,9 +120,7 @@ public function settings(array $params = []) | |
|
||
return $this->performRequest($endpoint); | ||
} /** | ||
* Proxy function to closeCursor() to prevent BC break. | ||
* This API will be removed in a future version. Use 'close' API instead. | ||
* Note that the SQL close API takes the cursor in the body. | ||
* | ||
* $params['cursor'] = (string) The cursor given by the server | ||
* | ||
|
@@ -190,6 +138,56 @@ public function closeCursor(array $params): array | |
])); | ||
$endpoint->setParams($params); | ||
Check failure on line 139 in src/OpenSearch/Namespaces/SqlNamespace.php GitHub Actions / PHPStan
|
||
|
||
return $this->performRequest($endpoint); | ||
Check failure on line 141 in src/OpenSearch/Namespaces/SqlNamespace.php GitHub Actions / PHPStan
Check failure on line 141 in src/OpenSearch/Namespaces/SqlNamespace.php GitHub Actions / PHPStan
|
||
} /** | ||
* $params['query'] = (string) The SQL Query | ||
* | ||
* @param array{'query': string} $params Associative array of parameters | ||
* @return array | ||
* | ||
* Note: Use of query parameter is deprecated. Pass it in `body` instead. | ||
*/ | ||
public function explain(array $params): array | ||
{ | ||
$endpointBuilder = $this->endpoints; | ||
|
||
$body = $this->extractArgument($params, 'body') ?? []; | ||
$query = $this->extractArgument($params, 'query'); | ||
|
||
/** @var AbstractEndpoint $endpoint */ | ||
$endpoint = $endpointBuilder('Sql\Explain'); | ||
Check failure on line 158 in src/OpenSearch/Namespaces/SqlNamespace.php GitHub Actions / PHPStan
Check failure on line 158 in src/OpenSearch/Namespaces/SqlNamespace.php GitHub Actions / PHPStan
|
||
$endpoint->setBody(array_merge($body, [ | ||
Check failure on line 159 in src/OpenSearch/Namespaces/SqlNamespace.php GitHub Actions / PHPStan
|
||
'query' => $query, | ||
])); | ||
$endpoint->setParams($params); | ||
Check failure on line 162 in src/OpenSearch/Namespaces/SqlNamespace.php GitHub Actions / PHPStan
|
||
|
||
return $this->performRequest($endpoint); | ||
Check failure on line 164 in src/OpenSearch/Namespaces/SqlNamespace.php GitHub Actions / PHPStan
Check failure on line 164 in src/OpenSearch/Namespaces/SqlNamespace.php GitHub Actions / PHPStan
|
||
} /** | ||
* $params['query'] = (string) The SQL Query | ||
* $params['format'] = (string) The response format | ||
* $params['cursor'] = (string) The cursor given by the server | ||
* $params['fetch_size'] = (int) The fetch size | ||
* | ||
* @param array{'query'?: string, 'cursor'?: string, 'fetch_size'?: int} $params Associative array of parameters | ||
* @return array | ||
* | ||
* Note: Use of `query`, `cursor` and `fetch_size` parameters is deprecated. Pass them in `body` instead. | ||
* | ||
*/ | ||
public function query(array $params): array | ||
{ | ||
$endpointBuilder = $this->endpoints; | ||
|
||
/** @var AbstractEndpoint $endpoint */ | ||
$endpoint = $endpointBuilder('Sql\Query'); | ||
Check failure on line 182 in src/OpenSearch/Namespaces/SqlNamespace.php GitHub Actions / PHPStan
Check failure on line 182 in src/OpenSearch/Namespaces/SqlNamespace.php GitHub Actions / PHPStan
|
||
$body = $this->extractArgument($params, 'body') ?? []; | ||
$endpoint->setBody(array_merge($body, array_filter([ | ||
Check failure on line 184 in src/OpenSearch/Namespaces/SqlNamespace.php GitHub Actions / PHPStan
|
||
'query' => $this->extractArgument($params, 'query'), | ||
'cursor' => $this->extractArgument($params, 'cursor'), | ||
'fetch_size' => $this->extractArgument($params, 'fetch_size'), | ||
]))); | ||
$endpoint->setParams($params); | ||
|
||
return $this->performRequest($endpoint); | ||
} | ||
} |