1<?php 2/** 3 * Elasticsearch PHP client 4 * 5 * @link https://github.com/elastic/elasticsearch-php/ 6 * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co) 7 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 8 * @license https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1 9 * 10 * Licensed to Elasticsearch B.V under one or more agreements. 11 * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or 12 * the GNU Lesser General Public License, Version 2.1, at your option. 13 * See the LICENSE file in the project root for more information. 14 */ 15declare(strict_types = 1); 16 17namespace Elasticsearch\Namespaces; 18 19use Elasticsearch\Namespaces\AbstractNamespace; 20 21/** 22 * Class SqlNamespace 23 * 24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php 25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee) 26 */ 27class SqlNamespace extends AbstractNamespace 28{ 29 30 /** 31 * Clears the SQL cursor 32 * 33 * $params['body'] = (array) Specify the cursor value in the `cursor` element to clean the cursor. (Required) 34 * 35 * @param array $params Associative array of parameters 36 * @return array 37 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-sql-cursor-api.html 38 */ 39 public function clearCursor(array $params = []) 40 { 41 $body = $this->extractArgument($params, 'body'); 42 43 $endpointBuilder = $this->endpoints; 44 $endpoint = $endpointBuilder('Sql\ClearCursor'); 45 $endpoint->setParams($params); 46 $endpoint->setBody($body); 47 48 return $this->performRequest($endpoint); 49 } 50 /** 51 * Deletes an async SQL search or a stored synchronous SQL search. If the search is still running, the API cancels it. 52 * 53 * $params['id'] = (string) The async search ID 54 * 55 * @param array $params Associative array of parameters 56 * @return array 57 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-async-sql-search-api.html 58 */ 59 public function deleteAsync(array $params = []) 60 { 61 $id = $this->extractArgument($params, 'id'); 62 63 $endpointBuilder = $this->endpoints; 64 $endpoint = $endpointBuilder('Sql\DeleteAsync'); 65 $endpoint->setParams($params); 66 $endpoint->setId($id); 67 68 return $this->performRequest($endpoint); 69 } 70 /** 71 * Returns the current status and available results for an async SQL search or stored synchronous SQL search 72 * 73 * $params['id'] = (string) The async search ID 74 * $params['delimiter'] = (string) Separator for CSV results (Default = ,) 75 * $params['format'] = (string) Short version of the Accept header, e.g. json, yaml 76 * $params['keep_alive'] = (time) Retention period for the search and its results (Default = 5d) 77 * $params['wait_for_completion_timeout'] = (time) Duration to wait for complete results 78 * 79 * @param array $params Associative array of parameters 80 * @return array 81 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-sql-search-api.html 82 */ 83 public function getAsync(array $params = []) 84 { 85 $id = $this->extractArgument($params, 'id'); 86 87 $endpointBuilder = $this->endpoints; 88 $endpoint = $endpointBuilder('Sql\GetAsync'); 89 $endpoint->setParams($params); 90 $endpoint->setId($id); 91 92 return $this->performRequest($endpoint); 93 } 94 /** 95 * Returns the current status of an async SQL search or a stored synchronous SQL search 96 * 97 * $params['id'] = (string) The async search ID 98 * 99 * @param array $params Associative array of parameters 100 * @return array 101 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-async-sql-search-status-api.html 102 */ 103 public function getAsyncStatus(array $params = []) 104 { 105 $id = $this->extractArgument($params, 'id'); 106 107 $endpointBuilder = $this->endpoints; 108 $endpoint = $endpointBuilder('Sql\GetAsyncStatus'); 109 $endpoint->setParams($params); 110 $endpoint->setId($id); 111 112 return $this->performRequest($endpoint); 113 } 114 /** 115 * Executes a SQL request 116 * 117 * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml 118 * $params['body'] = (array) Use the `query` element to start a query. Use the `cursor` element to continue a query. (Required) 119 * 120 * @param array $params Associative array of parameters 121 * @return array 122 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-search-api.html 123 */ 124 public function query(array $params = []) 125 { 126 $body = $this->extractArgument($params, 'body'); 127 128 $endpointBuilder = $this->endpoints; 129 $endpoint = $endpointBuilder('Sql\Query'); 130 $endpoint->setParams($params); 131 $endpoint->setBody($body); 132 133 return $this->performRequest($endpoint); 134 } 135 /** 136 * Translates SQL into Elasticsearch queries 137 * 138 * $params['body'] = (array) Specify the query in the `query` element. (Required) 139 * 140 * @param array $params Associative array of parameters 141 * @return array 142 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-translate-api.html 143 */ 144 public function translate(array $params = []) 145 { 146 $body = $this->extractArgument($params, 'body'); 147 148 $endpointBuilder = $this->endpoints; 149 $endpoint = $endpointBuilder('Sql\Translate'); 150 $endpoint->setParams($params); 151 $endpoint->setBody($body); 152 153 return $this->performRequest($endpoint); 154 } 155} 156