1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | /** |
6: | * Copyright OpenSearch Contributors |
7: | * SPDX-License-Identifier: Apache-2.0 |
8: | * |
9: | * OpenSearch PHP client |
10: | * |
11: | * @link https://github.com/opensearch-project/opensearch-php/ |
12: | * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co) |
13: | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 |
14: | * @license https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1 |
15: | * |
16: | * Licensed to Elasticsearch B.V under one or more agreements. |
17: | * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or |
18: | * the GNU Lesser General Public License, Version 2.1, at your option. |
19: | * See the LICENSE file in the project root for more information. |
20: | */ |
21: | |
22: | namespace OpenSearch; |
23: | |
24: | use OpenSearch\Common\Exceptions\BadMethodCallException; |
25: | use OpenSearch\Common\Exceptions\NoNodesAvailableException; |
26: | use OpenSearch\Endpoints\AbstractEndpoint; |
27: | use OpenSearch\Namespaces\NamespaceBuilderInterface; |
28: | use OpenSearch\Namespaces\BooleanRequestWrapper; |
29: | use OpenSearch\Namespaces\AsyncSearchNamespace; |
30: | use OpenSearch\Namespaces\AsynchronousSearchNamespace; |
31: | use OpenSearch\Namespaces\CatNamespace; |
32: | use OpenSearch\Namespaces\ClusterNamespace; |
33: | use OpenSearch\Namespaces\DanglingIndicesNamespace; |
34: | use OpenSearch\Namespaces\DataFrameTransformDeprecatedNamespace; |
35: | use OpenSearch\Namespaces\FlowFrameworkNamespace; |
36: | use OpenSearch\Namespaces\IndicesNamespace; |
37: | use OpenSearch\Namespaces\IngestNamespace; |
38: | use OpenSearch\Namespaces\InsightsNamespace; |
39: | use OpenSearch\Namespaces\IsmNamespace; |
40: | use OpenSearch\Namespaces\KnnNamespace; |
41: | use OpenSearch\Namespaces\ListNamespace; |
42: | use OpenSearch\Namespaces\MlNamespace; |
43: | use OpenSearch\Namespaces\MonitoringNamespace; |
44: | use OpenSearch\Namespaces\NodesNamespace; |
45: | use OpenSearch\Namespaces\NotificationsNamespace; |
46: | use OpenSearch\Namespaces\ObservabilityNamespace; |
47: | use OpenSearch\Namespaces\PplNamespace; |
48: | use OpenSearch\Namespaces\QueryNamespace; |
49: | use OpenSearch\Namespaces\RemoteStoreNamespace; |
50: | use OpenSearch\Namespaces\RollupsNamespace; |
51: | use OpenSearch\Namespaces\SearchPipelineNamespace; |
52: | use OpenSearch\Namespaces\SearchableSnapshotsNamespace; |
53: | use OpenSearch\Namespaces\SecurityNamespace; |
54: | use OpenSearch\Namespaces\SnapshotNamespace; |
55: | use OpenSearch\Namespaces\SqlNamespace; |
56: | use OpenSearch\Namespaces\SslNamespace; |
57: | use OpenSearch\Namespaces\TasksNamespace; |
58: | use OpenSearch\Namespaces\TransformsNamespace; |
59: | use OpenSearch\Namespaces\WlmNamespace; |
60: | use OpenSearch\Traits\DeprecatedPropertyTrait; |
61: | |
62: | /** |
63: | * Class Client |
64: | * |
65: | * NOTE: This file is autogenerated using util/GenerateEndpoints.php |
66: | */ |
67: | class Client |
68: | { |
69: | public const VERSION = '2.3.1'; |
70: | |
71: | /** |
72: | * @var Transport |
73: | */ |
74: | public $transport; |
75: | |
76: | /** |
77: | * @var array |
78: | */ |
79: | protected $params; |
80: | |
81: | private EndpointFactoryInterface $endpointFactory; |
82: | |
83: | /** |
84: | * @var callable |
85: | * |
86: | * @deprecated in 2.3.2 and will be removed in 3.0.0. |
87: | */ |
88: | protected $endpoints; |
89: | |
90: | /** |
91: | * @var NamespaceBuilderInterface[] |
92: | */ |
93: | protected $registeredNamespaces = []; |
94: | |
95: | /** |
96: | * @var AsyncSearchNamespace |
97: | */ |
98: | protected $asyncSearch; |
99: | |
100: | /** |
101: | * @var AsynchronousSearchNamespace |
102: | */ |
103: | protected $asynchronousSearch; |
104: | |
105: | /** |
106: | * @var CatNamespace |
107: | */ |
108: | protected $cat; |
109: | |
110: | /** |
111: | * @var ClusterNamespace |
112: | */ |
113: | protected $cluster; |
114: | |
115: | /** |
116: | * @var DanglingIndicesNamespace |
117: | */ |
118: | protected $danglingIndices; |
119: | |
120: | /** |
121: | * @var DataFrameTransformDeprecatedNamespace |
122: | */ |
123: | protected $dataFrameTransformDeprecated; |
124: | |
125: | /** |
126: | * @var FlowFrameworkNamespace |
127: | */ |
128: | protected $flowFramework; |
129: | |
130: | /** |
131: | * @var IndicesNamespace |
132: | */ |
133: | protected $indices; |
134: | |
135: | /** |
136: | * @var IngestNamespace |
137: | */ |
138: | protected $ingest; |
139: | |
140: | /** |
141: | * @var InsightsNamespace |
142: | */ |
143: | protected $insights; |
144: | |
145: | /** |
146: | * @var IsmNamespace |
147: | */ |
148: | protected $ism; |
149: | |
150: | /** |
151: | * @var KnnNamespace |
152: | */ |
153: | protected $knn; |
154: | |
155: | /** |
156: | * @var ListNamespace |
157: | */ |
158: | protected $list; |
159: | |
160: | /** |
161: | * @var MlNamespace |
162: | */ |
163: | protected $ml; |
164: | |
165: | /** |
166: | * @var MonitoringNamespace |
167: | */ |
168: | protected $monitoring; |
169: | |
170: | /** |
171: | * @var NodesNamespace |
172: | */ |
173: | protected $nodes; |
174: | |
175: | /** |
176: | * @var NotificationsNamespace |
177: | */ |
178: | protected $notifications; |
179: | |
180: | /** |
181: | * @var ObservabilityNamespace |
182: | */ |
183: | protected $observability; |
184: | |
185: | /** |
186: | * @var PplNamespace |
187: | */ |
188: | protected $ppl; |
189: | |
190: | /** |
191: | * @var QueryNamespace |
192: | */ |
193: | protected $query; |
194: | |
195: | /** |
196: | * @var RemoteStoreNamespace |
197: | */ |
198: | protected $remoteStore; |
199: | |
200: | /** |
201: | * @var RollupsNamespace |
202: | */ |
203: | protected $rollups; |
204: | |
205: | /** |
206: | * @var SearchPipelineNamespace |
207: | */ |
208: | protected $searchPipeline; |
209: | |
210: | /** |
211: | * @var SearchableSnapshotsNamespace |
212: | */ |
213: | protected $searchableSnapshots; |
214: | |
215: | /** |
216: | * @var SecurityNamespace |
217: | */ |
218: | protected $security; |
219: | |
220: | /** |
221: | * @var SnapshotNamespace |
222: | */ |
223: | protected $snapshot; |
224: | |
225: | /** |
226: | * @var SqlNamespace |
227: | */ |
228: | protected $sql; |
229: | |
230: | /** |
231: | * @var SslNamespace |
232: | */ |
233: | protected $ssl; |
234: | |
235: | /** |
236: | * @var TasksNamespace |
237: | */ |
238: | protected $tasks; |
239: | |
240: | /** |
241: | * @var TransformsNamespace |
242: | */ |
243: | protected $transforms; |
244: | |
245: | /** |
246: | * @var WlmNamespace |
247: | */ |
248: | protected $wlm; |
249: | |
250: | |
251: | /** |
252: | * Client constructor |
253: | * |
254: | * @param Transport $transport |
255: | * @param callable|EndpointFactoryInterface $endpointFactory |
256: | * @param NamespaceBuilderInterface[] $registeredNamespaces |
257: | */ |
258: | public function __construct(Transport $transport, callable|EndpointFactoryInterface $endpointFactory, array $registeredNamespaces) |
259: | { |
260: | $this->transport = $transport; |
261: | if (is_callable($endpointFactory)) { |
262: | @trigger_error('Passing a callable as the $endpointFactory param in ' . __METHOD__ . ' is deprecated in 2.3.2 and will be removed in 3.0.0. Pass an instance of \OpenSearch\EndpointFactoryInterface instead.', E_USER_DEPRECATED); |
263: | $endpoints = $endpointFactory; |
264: | $endpointFactory = new LegacyEndpointFactory($endpointFactory); |
265: | } else { |
266: | $endpoints = function ($c) use ($endpointFactory) { |
267: | @trigger_error('The $endpoints property is deprecated in 2.3.2 and will be removed in 3.0.0.', E_USER_DEPRECATED); |
268: | return $endpointFactory->getEndpoint('OpenSearch\\Endpoints\\' . $c); |
269: | }; |
270: | } |
271: | $this->endpoints = $endpoints; |
272: | $this->endpointFactory = $endpointFactory; |
273: | $this->asyncSearch = new AsyncSearchNamespace($transport, $this->endpointFactory); |
274: | $this->asynchronousSearch = new AsynchronousSearchNamespace($transport, $this->endpointFactory); |
275: | $this->cat = new CatNamespace($transport, $this->endpointFactory); |
276: | $this->cluster = new ClusterNamespace($transport, $this->endpointFactory); |
277: | $this->danglingIndices = new DanglingIndicesNamespace($transport, $this->endpointFactory); |
278: | $this->dataFrameTransformDeprecated = new DataFrameTransformDeprecatedNamespace($transport, $this->endpointFactory); |
279: | $this->flowFramework = new FlowFrameworkNamespace($transport, $this->endpointFactory); |
280: | $this->indices = new IndicesNamespace($transport, $this->endpointFactory); |
281: | $this->ingest = new IngestNamespace($transport, $this->endpointFactory); |
282: | $this->insights = new InsightsNamespace($transport, $this->endpointFactory); |
283: | $this->ism = new IsmNamespace($transport, $this->endpointFactory); |
284: | $this->knn = new KnnNamespace($transport, $this->endpointFactory); |
285: | $this->list = new ListNamespace($transport, $this->endpointFactory); |
286: | $this->ml = new MlNamespace($transport, $this->endpointFactory); |
287: | $this->monitoring = new MonitoringNamespace($transport, $this->endpointFactory); |
288: | $this->nodes = new NodesNamespace($transport, $this->endpointFactory); |
289: | $this->notifications = new NotificationsNamespace($transport, $this->endpointFactory); |
290: | $this->observability = new ObservabilityNamespace($transport, $this->endpointFactory); |
291: | $this->ppl = new PplNamespace($transport, $this->endpointFactory); |
292: | $this->query = new QueryNamespace($transport, $this->endpointFactory); |
293: | $this->remoteStore = new RemoteStoreNamespace($transport, $this->endpointFactory); |
294: | $this->rollups = new RollupsNamespace($transport, $this->endpointFactory); |
295: | $this->searchPipeline = new SearchPipelineNamespace($transport, $this->endpointFactory); |
296: | $this->searchableSnapshots = new SearchableSnapshotsNamespace($transport, $this->endpointFactory); |
297: | $this->security = new SecurityNamespace($transport, $this->endpointFactory); |
298: | $this->snapshot = new SnapshotNamespace($transport, $this->endpointFactory); |
299: | $this->sql = new SqlNamespace($transport, $this->endpointFactory); |
300: | $this->ssl = new SslNamespace($transport, $this->endpointFactory); |
301: | $this->tasks = new TasksNamespace($transport, $this->endpointFactory); |
302: | $this->transforms = new TransformsNamespace($transport, $this->endpointFactory); |
303: | $this->wlm = new WlmNamespace($transport, $this->endpointFactory); |
304: | |
305: | $this->registeredNamespaces = $registeredNamespaces; |
306: | } |
307: | |
308: | /** |
309: | * Allows to perform multiple index/update/delete operations in a single request. |
310: | * |
311: | * $params['index'] = (string) Name of the data stream, index, or index alias to perform bulk actions on. |
312: | * $params['_source'] = (any) `true` or `false` to return the `_source` field or not, or a list of fields to return. |
313: | * $params['_source_excludes'] = (any) A comma-separated list of source fields to exclude from the response. |
314: | * $params['_source_includes'] = (any) A comma-separated list of source fields to include in the response. |
315: | * $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. |
316: | * $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) |
317: | * $params['require_alias'] = (boolean) If `true`, the request's actions must target an index alias. (Default = false) |
318: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
319: | * $params['timeout'] = (string) Period each action waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. |
320: | * $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`). |
321: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
322: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
323: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
324: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
325: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
326: | * $params['body'] = (array) The operation definition and data (action-data pairs), separated by newlines (Required) |
327: | * |
328: | * @param array $params Associative array of parameters |
329: | * @return array |
330: | */ |
331: | public function bulk(array $params = []) |
332: | { |
333: | $index = $this->extractArgument($params, 'index'); |
334: | $body = $this->extractArgument($params, 'body'); |
335: | |
336: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Bulk::class); |
337: | $endpoint->setParams($params); |
338: | $endpoint->setIndex($index); |
339: | $endpoint->setBody($body); |
340: | |
341: | return $this->performRequest($endpoint); |
342: | } |
343: | |
344: | /** |
345: | * Allows to perform multiple index/update/delete operations using request response streaming. |
346: | * |
347: | * $params['index'] = (string) Name of the data stream, index, or index alias to perform bulk actions on. |
348: | * $params['_source'] = (any) `true` or `false` to return the `_source` field or not, or a list of fields to return. |
349: | * $params['_source_excludes'] = (any) A comma-separated list of source fields to exclude from the response. |
350: | * $params['_source_includes'] = (any) A comma-separated list of source fields to include in the response. |
351: | * $params['batch_interval'] = (string) Specifies for how long bulk operations should be accumulated into a batch before sending the batch to data nodes. |
352: | * $params['batch_size'] = (integer) Specifies how many bulk operations should be accumulated into a batch before sending the batch to data nodes. |
353: | * $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. |
354: | * $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) |
355: | * $params['require_alias'] = (boolean) If `true`, the request's actions must target an index alias. (Default = false) |
356: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
357: | * $params['timeout'] = (string) Period each action waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. |
358: | * $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`). |
359: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
360: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
361: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
362: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
363: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
364: | * $params['body'] = (array) The operation definition and data (action-data pairs), separated by newlines (Required) |
365: | * |
366: | * @param array $params Associative array of parameters |
367: | * @return array |
368: | */ |
369: | public function bulkStream(array $params = []) |
370: | { |
371: | $index = $this->extractArgument($params, 'index'); |
372: | $body = $this->extractArgument($params, 'body'); |
373: | |
374: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\BulkStream::class); |
375: | $endpoint->setParams($params); |
376: | $endpoint->setIndex($index); |
377: | $endpoint->setBody($body); |
378: | |
379: | return $this->performRequest($endpoint); |
380: | } |
381: | |
382: | /** |
383: | * Explicitly clears the search context for a scroll. |
384: | * |
385: | * $params['scroll_id'] = DEPRECATED (array) Comma-separated list of scroll IDs to clear. To clear all scroll IDs, use `_all`. |
386: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
387: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
388: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
389: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
390: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
391: | * $params['body'] = (array) Comma-separated list of scroll IDs to clear if none was specified using the `scroll_id` parameter |
392: | * |
393: | * @param array $params Associative array of parameters |
394: | * @return array |
395: | */ |
396: | public function clearScroll(array $params = []) |
397: | { |
398: | $scroll_id = $this->extractArgument($params, 'scroll_id'); |
399: | $body = $this->extractArgument($params, 'body'); |
400: | |
401: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\ClearScroll::class); |
402: | $endpoint->setParams($params); |
403: | $endpoint->setScrollId($scroll_id); |
404: | $endpoint->setBody($body); |
405: | |
406: | return $this->performRequest($endpoint); |
407: | } |
408: | |
409: | /** |
410: | * Returns number of documents matching a query. |
411: | * |
412: | * $params['index'] = (array) Comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (`*`). To search all data streams and indexes, omit this parameter or use `*` or `_all`. |
413: | * $params['allow_no_indices'] = (boolean) If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes.This behavior applies even if the request targets other open indexes. |
414: | * $params['analyze_wildcard'] = (boolean) If `true`, wildcard and prefix queries are analyzed.This parameter can only be used when the `q` query string parameter is specified. (Default = false) |
415: | * $params['analyzer'] = (string) Analyzer to use for the query string.This parameter can only be used when the `q` query string parameter is specified. |
416: | * $params['default_operator'] = (enum) The default operator for query string query: `AND` or `OR`.This parameter can only be used when the `q` query string parameter is specified. (Options = and,or) |
417: | * $params['df'] = (string) Field to use as default where no field prefix is given in the query string.This parameter can only be used when the `q` query string parameter is specified. |
418: | * $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`. |
419: | * $params['ignore_throttled'] = (boolean) If `true`, concrete, expanded or aliased indexes are ignored when frozen. |
420: | * $params['ignore_unavailable'] = (boolean) If `false`, the request returns an error if it targets a missing or closed index. |
421: | * $params['lenient'] = (boolean) If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. |
422: | * $params['min_score'] = (number) Sets the minimum `_score` value that documents must have to be included in the result. |
423: | * $params['preference'] = (string) Specifies the node or shard the operation should be performed on.Random by default. (Default = random) |
424: | * $params['q'] = (string) Query in the Lucene query string syntax. |
425: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
426: | * $params['terminate_after'] = (integer) 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. |
427: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
428: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
429: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
430: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
431: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
432: | * $params['body'] = (array) Query to restrict the results specified with the Query DSL (optional) |
433: | * |
434: | * @param array $params Associative array of parameters |
435: | * @return array |
436: | */ |
437: | public function count(array $params = []) |
438: | { |
439: | $index = $this->extractArgument($params, 'index'); |
440: | $body = $this->extractArgument($params, 'body'); |
441: | |
442: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Count::class); |
443: | $endpoint->setParams($params); |
444: | $endpoint->setIndex($index); |
445: | $endpoint->setBody($body); |
446: | |
447: | return $this->performRequest($endpoint); |
448: | } |
449: | |
450: | /** |
451: | * Creates point in time context. |
452: | * |
453: | * $params['index'] = (array) Comma-separated list of indexes; use `_all` or empty string to perform the operation on all indexes. (Required) |
454: | * $params['allow_partial_pit_creation'] = (boolean) Allow if point in time can be created with partial failures. |
455: | * $params['expand_wildcards'] = (any) Whether to expand wildcard expression to concrete indexes that are open, closed or both. |
456: | * $params['keep_alive'] = (string) Specify the keep alive for point in time. |
457: | * $params['preference'] = (string) Specify the node or shard the operation should be performed on. (Default = random) |
458: | * $params['routing'] = (any) Comma-separated list of specific routing values. |
459: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
460: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
461: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
462: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
463: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
464: | * |
465: | * @param array $params Associative array of parameters |
466: | * @return array |
467: | */ |
468: | public function createPit(array $params = []) |
469: | { |
470: | $index = $this->extractArgument($params, 'index'); |
471: | |
472: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\CreatePit::class); |
473: | $endpoint->setParams($params); |
474: | $endpoint->setIndex($index); |
475: | |
476: | return $this->performRequest($endpoint); |
477: | } |
478: | |
479: | /** |
480: | * Removes a document from the index. |
481: | * |
482: | * $params['id'] = (string) Unique identifier for the document. (Required) |
483: | * $params['index'] = (string) Name of the target index. (Required) |
484: | * $params['if_primary_term'] = (integer) Only perform the operation if the document has this primary term. |
485: | * $params['if_seq_no'] = (integer) Only perform the operation if the document has this sequence number. |
486: | * $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) |
487: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
488: | * $params['timeout'] = (string) Period to wait for active shards. |
489: | * $params['version'] = (integer) Explicit version number for concurrency control.The specified version must match the current version of the document for the request to succeed. |
490: | * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = external,external_gte,force,internal) |
491: | * $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`). |
492: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
493: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
494: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
495: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
496: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
497: | * |
498: | * @param array $params Associative array of parameters |
499: | * @return array |
500: | */ |
501: | public function delete(array $params = []) |
502: | { |
503: | $id = $this->extractArgument($params, 'id'); |
504: | $index = $this->extractArgument($params, 'index'); |
505: | |
506: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Delete::class); |
507: | $endpoint->setParams($params); |
508: | $endpoint->setId($id); |
509: | $endpoint->setIndex($index); |
510: | |
511: | return $this->performRequest($endpoint); |
512: | } |
513: | |
514: | /** |
515: | * Deletes all active point in time searches. |
516: | * |
517: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
518: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
519: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
520: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
521: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
522: | * |
523: | * @param array $params Associative array of parameters |
524: | * @return array |
525: | */ |
526: | public function deleteAllPits(array $params = []) |
527: | { |
528: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeleteAllPits::class); |
529: | $endpoint->setParams($params); |
530: | |
531: | return $this->performRequest($endpoint); |
532: | } |
533: | |
534: | /** |
535: | * Deletes documents matching the provided query. |
536: | * |
537: | * $params['index'] = (array) Comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (`*`). To search all data streams or indexes, omit this parameter or use `*` or `_all`. (Required) |
538: | * $params['_source'] = (array) True or false to return the _source field or not, or a list of fields to return. |
539: | * $params['_source_excludes'] = (array) List of fields to exclude from the returned _source field. |
540: | * $params['_source_includes'] = (array) List of fields to extract and return from the _source field. |
541: | * $params['allow_no_indices'] = (boolean) If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes.This behavior applies even if the request targets other open indexes.For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. |
542: | * $params['analyze_wildcard'] = (boolean) If `true`, wildcard and prefix queries are analyzed. (Default = false) |
543: | * $params['analyzer'] = (string) Analyzer to use for the query string. |
544: | * $params['conflicts'] = (enum) What to do if delete by query hits version conflicts: `abort` or `proceed`. (Options = abort,proceed) |
545: | * $params['default_operator'] = (enum) The default operator for query string query: `AND` or `OR`. (Options = and,or) |
546: | * $params['df'] = (string) Field to use as default where no field prefix is given in the query string. |
547: | * $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`. |
548: | * $params['from'] = (integer) Starting offset. (Default = 0) |
549: | * $params['ignore_unavailable'] = (boolean) If `false`, the request returns an error if it targets a missing or closed index. |
550: | * $params['lenient'] = (boolean) If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. |
551: | * $params['max_docs'] = (integer) Maximum number of documents to process.Defaults to all documents. |
552: | * $params['preference'] = (string) Specifies the node or shard the operation should be performed on.Random by default. (Default = random) |
553: | * $params['q'] = (string) Query in the Lucene query string syntax. |
554: | * $params['refresh'] = (boolean) If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes. |
555: | * $params['request_cache'] = (boolean) If `true`, the request cache is used for this request.Defaults to the index-level setting. |
556: | * $params['requests_per_second'] = (number) The throttle for this request in sub-requests per second. (Default = 0) |
557: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
558: | * $params['scroll'] = (string) Period to retain the search context for scrolling. |
559: | * $params['scroll_size'] = (integer) Size of the scroll request that powers the operation. (Default = 100) |
560: | * $params['search_timeout'] = (string) Explicit timeout for each search request.Defaults to no timeout. |
561: | * $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) |
562: | * $params['size'] = (integer) Deprecated, please use `max_docs` instead. |
563: | * $params['slices'] = (any) The number of slices this task should be divided into. |
564: | * $params['sort'] = (array) A comma-separated list of <field>:<direction> pairs. |
565: | * $params['stats'] = (array) Specific `tag` of the request for logging and statistical purposes. |
566: | * $params['terminate_after'] = (integer) 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 indexes across multiple data tiers. |
567: | * $params['timeout'] = (string) Period each deletion request waits for active shards. |
568: | * $params['version'] = (boolean) If `true`, returns the document version as part of a hit. |
569: | * $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`). |
570: | * $params['wait_for_completion'] = (boolean) If `true`, the request blocks until the operation is complete. (Default = true) |
571: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
572: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
573: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
574: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
575: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
576: | * $params['body'] = (array) The search definition using the Query DSL (Required) |
577: | * |
578: | * @param array $params Associative array of parameters |
579: | * @return array |
580: | */ |
581: | public function deleteByQuery(array $params = []) |
582: | { |
583: | $index = $this->extractArgument($params, 'index'); |
584: | $body = $this->extractArgument($params, 'body'); |
585: | |
586: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeleteByQuery::class); |
587: | $endpoint->setParams($params); |
588: | $endpoint->setIndex($index); |
589: | $endpoint->setBody($body); |
590: | |
591: | return $this->performRequest($endpoint); |
592: | } |
593: | |
594: | /** |
595: | * Changes the number of requests per second for a particular Delete By Query operation. |
596: | * |
597: | * $params['task_id'] = (number) The ID for the task. (Required) |
598: | * $params['requests_per_second'] = (number) The throttle for this request in sub-requests per second. |
599: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
600: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
601: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
602: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
603: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
604: | * |
605: | * @param array $params Associative array of parameters |
606: | * @return array |
607: | */ |
608: | public function deleteByQueryRethrottle(array $params = []) |
609: | { |
610: | $task_id = $this->extractArgument($params, 'task_id'); |
611: | |
612: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeleteByQueryRethrottle::class); |
613: | $endpoint->setParams($params); |
614: | $endpoint->setTaskId($task_id); |
615: | |
616: | return $this->performRequest($endpoint); |
617: | } |
618: | |
619: | /** |
620: | * Deletes one or more point in time searches based on the IDs passed. |
621: | * |
622: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
623: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
624: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
625: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
626: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
627: | * $params['body'] = (array) The point-in-time ids to be deleted |
628: | * |
629: | * @param array $params Associative array of parameters |
630: | * @return array |
631: | */ |
632: | public function deletePit(array $params = []) |
633: | { |
634: | $body = $this->extractArgument($params, 'body'); |
635: | |
636: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeletePit::class); |
637: | $endpoint->setParams($params); |
638: | $endpoint->setBody($body); |
639: | |
640: | return $this->performRequest($endpoint); |
641: | } |
642: | |
643: | /** |
644: | * Deletes a script. |
645: | * |
646: | * $params['id'] = (string) Identifier for the stored script or search template. (Required) |
647: | * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node. |
648: | * $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. |
649: | * $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. |
650: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
651: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
652: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
653: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
654: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
655: | * |
656: | * @param array $params Associative array of parameters |
657: | * @return array |
658: | */ |
659: | public function deleteScript(array $params = []) |
660: | { |
661: | $id = $this->extractArgument($params, 'id'); |
662: | |
663: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeleteScript::class); |
664: | $endpoint->setParams($params); |
665: | $endpoint->setId($id); |
666: | |
667: | return $this->performRequest($endpoint); |
668: | } |
669: | |
670: | /** |
671: | * Returns information about whether a document exists in an index. |
672: | * |
673: | * $params['id'] = (string) Identifier of the document. (Required) |
674: | * $params['index'] = (string) Comma-separated list of data streams, indexes, and aliases. Supports wildcards (`*`). (Required) |
675: | * $params['_source'] = (any) `true` or `false` to return the `_source` field or not, or a list of fields to return. |
676: | * $params['_source_excludes'] = (any) A comma-separated list of source fields to exclude in the response. |
677: | * $params['_source_includes'] = (any) A comma-separated list of source fields to include in the response. |
678: | * $params['preference'] = (string) Specifies the node or shard the operation should be performed on.Random by default. (Default = random) |
679: | * $params['realtime'] = (boolean) If `true`, the request is real-time as opposed to near-real-time. |
680: | * $params['refresh'] = (boolean) If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes. |
681: | * $params['routing'] = (any) Target the specified primary shard. |
682: | * $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. |
683: | * $params['version'] = (integer) Explicit version number for concurrency control.The specified version must match the current version of the document for the request to succeed. |
684: | * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = external,external_gte,force,internal) |
685: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
686: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
687: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
688: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
689: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
690: | * |
691: | * @param array $params Associative array of parameters |
692: | * @return bool |
693: | */ |
694: | public function exists(array $params = []): bool |
695: | { |
696: | $id = $this->extractArgument($params, 'id'); |
697: | $index = $this->extractArgument($params, 'index'); |
698: | |
699: | // manually make this verbose so we can check status code |
700: | $params['client']['verbose'] = true; |
701: | |
702: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Exists::class); |
703: | $endpoint->setParams($params); |
704: | $endpoint->setId($id); |
705: | $endpoint->setIndex($index); |
706: | |
707: | return BooleanRequestWrapper::performRequest($endpoint, $this->transport); |
708: | } |
709: | |
710: | /** |
711: | * Returns information about whether a document source exists in an index. |
712: | * |
713: | * $params['id'] = (string) Identifier of the document. (Required) |
714: | * $params['index'] = (string) Comma-separated list of data streams, indexes, and aliases. Supports wildcards (`*`). (Required) |
715: | * $params['_source'] = (any) `true` or `false` to return the `_source` field or not, or a list of fields to return. |
716: | * $params['_source_excludes'] = (any) A comma-separated list of source fields to exclude in the response. |
717: | * $params['_source_includes'] = (any) A comma-separated list of source fields to include in the response. |
718: | * $params['preference'] = (string) Specifies the node or shard the operation should be performed on.Random by default. (Default = random) |
719: | * $params['realtime'] = (boolean) If true, the request is real-time as opposed to near-real-time. |
720: | * $params['refresh'] = (boolean) If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes. |
721: | * $params['routing'] = (any) Target the specified primary shard. |
722: | * $params['version'] = (integer) Explicit version number for concurrency control.The specified version must match the current version of the document for the request to succeed. |
723: | * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = external,external_gte,force,internal) |
724: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
725: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
726: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
727: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
728: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
729: | * |
730: | * @param array $params Associative array of parameters |
731: | * @return bool |
732: | */ |
733: | public function existsSource(array $params = []): bool |
734: | { |
735: | $id = $this->extractArgument($params, 'id'); |
736: | $index = $this->extractArgument($params, 'index'); |
737: | |
738: | // manually make this verbose so we can check status code |
739: | $params['client']['verbose'] = true; |
740: | |
741: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\ExistsSource::class); |
742: | $endpoint->setParams($params); |
743: | $endpoint->setId($id); |
744: | $endpoint->setIndex($index); |
745: | |
746: | return BooleanRequestWrapper::performRequest($endpoint, $this->transport); |
747: | } |
748: | |
749: | /** |
750: | * Returns information about why a specific matches (or doesn't match) a query. |
751: | * |
752: | * $params['id'] = (string) Defines the document ID. (Required) |
753: | * $params['index'] = (string) Index names used to limit the request. Only a single index name can be provided to this parameter. (Required) |
754: | * $params['_source'] = (any) True or false to return the `_source` field or not, or a list of fields to return. |
755: | * $params['_source_excludes'] = (any) A comma-separated list of source fields to exclude from the response. |
756: | * $params['_source_includes'] = (any) A comma-separated list of source fields to include in the response. |
757: | * $params['analyze_wildcard'] = (boolean) If `true`, wildcard and prefix queries are analyzed. (Default = false) |
758: | * $params['analyzer'] = (string) Analyzer to use for the query string.This parameter can only be used when the `q` query string parameter is specified. |
759: | * $params['default_operator'] = (enum) The default operator for query string query: `AND` or `OR`. (Options = and,or) |
760: | * $params['df'] = (string) Field to use as default where no field prefix is given in the query string. (Default = _all) |
761: | * $params['lenient'] = (boolean) If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. |
762: | * $params['preference'] = (string) Specifies the node or shard the operation should be performed on.Random by default. (Default = random) |
763: | * $params['q'] = (string) Query in the Lucene query string syntax. |
764: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
765: | * $params['stored_fields'] = (any) A comma-separated list of stored fields to return in the response. |
766: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
767: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
768: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
769: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
770: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
771: | * $params['body'] = (array) The query definition using the Query DSL |
772: | * |
773: | * @param array $params Associative array of parameters |
774: | * @return array |
775: | */ |
776: | public function explain(array $params = []) |
777: | { |
778: | $id = $this->extractArgument($params, 'id'); |
779: | $index = $this->extractArgument($params, 'index'); |
780: | $body = $this->extractArgument($params, 'body'); |
781: | |
782: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Explain::class); |
783: | $endpoint->setParams($params); |
784: | $endpoint->setId($id); |
785: | $endpoint->setIndex($index); |
786: | $endpoint->setBody($body); |
787: | |
788: | return $this->performRequest($endpoint); |
789: | } |
790: | |
791: | /** |
792: | * Returns the information about the capabilities of fields among multiple indexes. |
793: | * |
794: | * $params['index'] = (array) Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indexes, omit this parameter or use * or _all. |
795: | * $params['allow_no_indices'] = (boolean) If false, the request returns an error if any wildcard expression, index alias,or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a requesttargeting `foo*,bar*` returns an error if an index starts with foo but no index starts with bar. |
796: | * $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`. |
797: | * $params['fields'] = (any) Comma-separated list of fields to retrieve capabilities for. Wildcard (`*`) expressions are supported. |
798: | * $params['ignore_unavailable'] = (boolean) If `true`, missing or closed indexes are not included in the response. |
799: | * $params['include_unmapped'] = (boolean) If true, unmapped fields are included in the response. (Default = false) |
800: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
801: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
802: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
803: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
804: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
805: | * $params['body'] = (array) An index filter specified with the Query DSL |
806: | * |
807: | * @param array $params Associative array of parameters |
808: | * @return array |
809: | */ |
810: | public function fieldCaps(array $params = []) |
811: | { |
812: | $index = $this->extractArgument($params, 'index'); |
813: | $body = $this->extractArgument($params, 'body'); |
814: | |
815: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FieldCaps::class); |
816: | $endpoint->setParams($params); |
817: | $endpoint->setIndex($index); |
818: | $endpoint->setBody($body); |
819: | |
820: | return $this->performRequest($endpoint); |
821: | } |
822: | |
823: | /** |
824: | * Returns a document. |
825: | * |
826: | * $params['id'] = (string) Unique identifier of the document. (Required) |
827: | * $params['index'] = (string) Name of the index that contains the document. (Required) |
828: | * $params['_source'] = (any) True or false to return the _source field or not, or a list of fields to return. |
829: | * $params['_source_excludes'] = (any) A comma-separated list of source fields to exclude in the response. |
830: | * $params['_source_includes'] = (any) A comma-separated list of source fields to include in the response. |
831: | * $params['preference'] = (string) Specifies the node or shard the operation should be performed on. Random by default. (Default = random) |
832: | * $params['realtime'] = (boolean) If `true`, the request is real-time as opposed to near-real-time. |
833: | * $params['refresh'] = (boolean) If true, OpenSearch refreshes the affected shards to make this operation visible to search. If false, do nothing with refreshes. |
834: | * $params['routing'] = (any) Target the specified primary shard. |
835: | * $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. |
836: | * $params['version'] = (integer) Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. |
837: | * $params['version_type'] = (enum) Specific version type: internal, external, external_gte. (Options = external,external_gte,force,internal) |
838: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
839: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
840: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
841: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
842: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
843: | * |
844: | * @param array $params Associative array of parameters |
845: | * @return array |
846: | */ |
847: | public function get(array $params = []) |
848: | { |
849: | $id = $this->extractArgument($params, 'id'); |
850: | $index = $this->extractArgument($params, 'index'); |
851: | |
852: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Get::class); |
853: | $endpoint->setParams($params); |
854: | $endpoint->setId($id); |
855: | $endpoint->setIndex($index); |
856: | |
857: | return $this->performRequest($endpoint); |
858: | } |
859: | |
860: | /** |
861: | * Lists all active point in time searches. |
862: | * |
863: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
864: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
865: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
866: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
867: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
868: | * |
869: | * @param array $params Associative array of parameters |
870: | * @return array |
871: | */ |
872: | public function getAllPits(array $params = []) |
873: | { |
874: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetAllPits::class); |
875: | $endpoint->setParams($params); |
876: | |
877: | return $this->performRequest($endpoint); |
878: | } |
879: | |
880: | /** |
881: | * Returns a script. |
882: | * |
883: | * $params['id'] = (string) Identifier for the stored script or search template. (Required) |
884: | * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node. |
885: | * $params['master_timeout'] = (string) Specify timeout for connection to master |
886: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
887: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
888: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
889: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
890: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
891: | * |
892: | * @param array $params Associative array of parameters |
893: | * @return array |
894: | */ |
895: | public function getScript(array $params = []) |
896: | { |
897: | $id = $this->extractArgument($params, 'id'); |
898: | |
899: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetScript::class); |
900: | $endpoint->setParams($params); |
901: | $endpoint->setId($id); |
902: | |
903: | return $this->performRequest($endpoint); |
904: | } |
905: | |
906: | /** |
907: | * Returns all script contexts. |
908: | * |
909: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
910: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
911: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
912: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
913: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
914: | * |
915: | * @param array $params Associative array of parameters |
916: | * @return array |
917: | */ |
918: | public function getScriptContext(array $params = []) |
919: | { |
920: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetScriptContext::class); |
921: | $endpoint->setParams($params); |
922: | |
923: | return $this->performRequest($endpoint); |
924: | } |
925: | |
926: | /** |
927: | * Returns available script types, languages and contexts. |
928: | * |
929: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
930: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
931: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
932: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
933: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
934: | * |
935: | * @param array $params Associative array of parameters |
936: | * @return array |
937: | */ |
938: | public function getScriptLanguages(array $params = []) |
939: | { |
940: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetScriptLanguages::class); |
941: | $endpoint->setParams($params); |
942: | |
943: | return $this->performRequest($endpoint); |
944: | } |
945: | |
946: | /** |
947: | * Returns the source of a document. |
948: | * |
949: | * $params['id'] = (string) Unique identifier of the document. (Required) |
950: | * $params['index'] = (string) Name of the index that contains the document. (Required) |
951: | * $params['_source'] = (any) True or false to return the _source field or not, or a list of fields to return. |
952: | * $params['_source_excludes'] = (any) A comma-separated list of source fields to exclude in the response. |
953: | * $params['_source_includes'] = (any) A comma-separated list of source fields to include in the response. |
954: | * $params['preference'] = (string) Specifies the node or shard the operation should be performed on. Random by default. (Default = random) |
955: | * $params['realtime'] = (boolean) Boolean) If true, the request is real-time as opposed to near-real-time. |
956: | * $params['refresh'] = (boolean) If true, OpenSearch refreshes the affected shards to make this operation visible to search. If false, do nothing with refreshes. |
957: | * $params['routing'] = (any) Target the specified primary shard. |
958: | * $params['version'] = (integer) Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. |
959: | * $params['version_type'] = (enum) Specific version type: internal, external, external_gte. (Options = external,external_gte,force,internal) |
960: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
961: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
962: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
963: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
964: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
965: | * |
966: | * @param array $params Associative array of parameters |
967: | * @return array |
968: | */ |
969: | public function getSource(array $params = []) |
970: | { |
971: | $id = $this->extractArgument($params, 'id'); |
972: | $index = $this->extractArgument($params, 'index'); |
973: | |
974: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetSource::class); |
975: | $endpoint->setParams($params); |
976: | $endpoint->setId($id); |
977: | $endpoint->setIndex($index); |
978: | |
979: | return $this->performRequest($endpoint); |
980: | } |
981: | |
982: | /** |
983: | * Creates or updates a document in an index. |
984: | * |
985: | * $params['index'] = (string) Name of the data stream or index to target. (Required) |
986: | * $params['id'] = (string) Unique identifier for the document. |
987: | * $params['if_primary_term'] = (integer) Only perform the operation if the document has this primary term. |
988: | * $params['if_seq_no'] = (integer) Only perform the operation if the document has this sequence number. |
989: | * $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 `<index>/_create` endpoint.Valid values: `index`, `create`.If document id is specified, it defaults to `index`.Otherwise, it defaults to `create`. (Options = create,index) |
990: | * $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. |
991: | * $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) |
992: | * $params['require_alias'] = (boolean) If `true`, the destination must be an index alias. (Default = false) |
993: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
994: | * $params['timeout'] = (string) Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. |
995: | * $params['version'] = (integer) Explicit version number for concurrency control.The specified version must match the current version of the document for the request to succeed. |
996: | * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = external,external_gte,force,internal) |
997: | * $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`). |
998: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
999: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1000: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1001: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1002: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1003: | * $params['body'] = (array) The document (Required) |
1004: | * |
1005: | * @param array $params Associative array of parameters |
1006: | * @return array |
1007: | */ |
1008: | public function index(array $params = []) |
1009: | { |
1010: | $index = $this->extractArgument($params, 'index'); |
1011: | $id = $this->extractArgument($params, 'id'); |
1012: | $body = $this->extractArgument($params, 'body'); |
1013: | |
1014: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Index::class); |
1015: | $endpoint->setParams($params); |
1016: | $endpoint->setIndex($index); |
1017: | $endpoint->setId($id); |
1018: | $endpoint->setBody($body); |
1019: | |
1020: | return $this->performRequest($endpoint); |
1021: | } |
1022: | |
1023: | /** |
1024: | * Returns basic information about the cluster. |
1025: | * |
1026: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1027: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1028: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1029: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1030: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1031: | * |
1032: | * @param array $params Associative array of parameters |
1033: | * @return array |
1034: | */ |
1035: | public function info(array $params = []) |
1036: | { |
1037: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Info::class); |
1038: | $endpoint->setParams($params); |
1039: | |
1040: | return $this->performRequest($endpoint); |
1041: | } |
1042: | |
1043: | /** |
1044: | * Allows to get multiple documents in one request. |
1045: | * |
1046: | * $params['index'] = (string) Name of the index to retrieve documents from when `ids` are specified, or when a document in the `docs` array does not specify an index. |
1047: | * $params['_source'] = (any) True or false to return the `_source` field or not, or a list of fields to return. |
1048: | * $params['_source_excludes'] = (any) A comma-separated list of source fields to exclude from the response.You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. |
1049: | * $params['_source_includes'] = (any) A comma-separated list of source fields to include in the response.If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter.If the `_source` parameter is `false`, this parameter is ignored. |
1050: | * $params['preference'] = (string) Specifies the node or shard the operation should be performed on. Random by default. (Default = random) |
1051: | * $params['realtime'] = (boolean) If `true`, the request is real-time as opposed to near-real-time. |
1052: | * $params['refresh'] = (boolean) If `true`, the request refreshes relevant shards before retrieving documents. |
1053: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
1054: | * $params['stored_fields'] = (any) If `true`, retrieves the document fields stored in the index rather than the document `_source`. |
1055: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1056: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1057: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1058: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1059: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1060: | * $params['body'] = (array) Document identifiers; can be either `docs` (containing full document information) or `ids` (when index is provided in the URL. (Required) |
1061: | * |
1062: | * @param array $params Associative array of parameters |
1063: | * @return array |
1064: | */ |
1065: | public function mget(array $params = []) |
1066: | { |
1067: | $index = $this->extractArgument($params, 'index'); |
1068: | $body = $this->extractArgument($params, 'body'); |
1069: | |
1070: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Mget::class); |
1071: | $endpoint->setParams($params); |
1072: | $endpoint->setIndex($index); |
1073: | $endpoint->setBody($body); |
1074: | |
1075: | return $this->performRequest($endpoint); |
1076: | } |
1077: | |
1078: | /** |
1079: | * Allows to execute several search operations in one request. |
1080: | * |
1081: | * $params['index'] = (array) Comma-separated list of data streams, indexes, and index aliases to search. |
1082: | * $params['ccs_minimize_roundtrips'] = (boolean) If true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests. (Default = true) |
1083: | * $params['max_concurrent_searches'] = (integer) Maximum number of concurrent searches the multi search API can execute. |
1084: | * $params['max_concurrent_shard_requests'] = (integer) Maximum number of concurrent shard requests that each sub-search request executes per node. (Default = 5) |
1085: | * $params['pre_filter_shard_size'] = (integer) 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. |
1086: | * $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) |
1087: | * $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) |
1088: | * $params['typed_keys'] = (boolean) Specifies whether aggregation and suggester names should be prefixed by their respective types in the response. |
1089: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1090: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1091: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1092: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1093: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1094: | * $params['body'] = (array) The request definitions (metadata-search request definition pairs), separated by newlines (Required) |
1095: | * |
1096: | * @param array $params Associative array of parameters |
1097: | * @return array |
1098: | */ |
1099: | public function msearch(array $params = []) |
1100: | { |
1101: | $index = $this->extractArgument($params, 'index'); |
1102: | $body = $this->extractArgument($params, 'body'); |
1103: | |
1104: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Msearch::class); |
1105: | $endpoint->setParams($params); |
1106: | $endpoint->setIndex($index); |
1107: | $endpoint->setBody($body); |
1108: | |
1109: | return $this->performRequest($endpoint); |
1110: | } |
1111: | |
1112: | /** |
1113: | * Allows to execute several search template operations in one request. |
1114: | * |
1115: | * $params['index'] = (array) Comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (`*`). To search all data streams and indexes, omit this parameter or use `*`. |
1116: | * $params['ccs_minimize_roundtrips'] = (boolean) If `true`, network round-trips are minimized for cross-cluster search requests. (Default = true) |
1117: | * $params['max_concurrent_searches'] = (integer) Maximum number of concurrent searches the API can run. |
1118: | * $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) |
1119: | * $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) |
1120: | * $params['typed_keys'] = (boolean) If `true`, the response prefixes aggregation and suggester names with their respective types. |
1121: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1122: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1123: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1124: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1125: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1126: | * $params['body'] = (array) The request definitions (metadata-search request definition pairs), separated by newlines (Required) |
1127: | * |
1128: | * @param array $params Associative array of parameters |
1129: | * @return array |
1130: | */ |
1131: | public function msearchTemplate(array $params = []) |
1132: | { |
1133: | $index = $this->extractArgument($params, 'index'); |
1134: | $body = $this->extractArgument($params, 'body'); |
1135: | |
1136: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\MsearchTemplate::class); |
1137: | $endpoint->setParams($params); |
1138: | $endpoint->setIndex($index); |
1139: | $endpoint->setBody($body); |
1140: | |
1141: | return $this->performRequest($endpoint); |
1142: | } |
1143: | |
1144: | /** |
1145: | * Returns multiple termvectors in one request. |
1146: | * |
1147: | * $params['index'] = (string) Name of the index that contains the documents. |
1148: | * $params['field_statistics'] = (boolean) If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies. (Default = true) |
1149: | * $params['fields'] = (any) Comma-separated list or wildcard expressions of fields to include in the statistics.Used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters. |
1150: | * $params['ids'] = (array) A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body |
1151: | * $params['offsets'] = (boolean) If `true`, the response includes term offsets. (Default = true) |
1152: | * $params['payloads'] = (boolean) If `true`, the response includes term payloads. (Default = true) |
1153: | * $params['positions'] = (boolean) If `true`, the response includes term positions. (Default = true) |
1154: | * $params['preference'] = (string) Specifies the node or shard the operation should be performed on.Random by default. (Default = random) |
1155: | * $params['realtime'] = (boolean) If true, the request is real-time as opposed to near-real-time. (Default = true) |
1156: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
1157: | * $params['term_statistics'] = (boolean) If true, the response includes term frequency and document frequency. (Default = false) |
1158: | * $params['version'] = (integer) If `true`, returns the document version as part of a hit. |
1159: | * $params['version_type'] = (enum) Specific version type. (Options = external,external_gte,force,internal) |
1160: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1161: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1162: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1163: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1164: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1165: | * $params['body'] = (array) Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation. |
1166: | * |
1167: | * @param array $params Associative array of parameters |
1168: | * @return array |
1169: | */ |
1170: | public function mtermvectors(array $params = []) |
1171: | { |
1172: | $index = $this->extractArgument($params, 'index'); |
1173: | $body = $this->extractArgument($params, 'body'); |
1174: | |
1175: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\MTermVectors::class); |
1176: | $endpoint->setParams($params); |
1177: | $endpoint->setIndex($index); |
1178: | $endpoint->setBody($body); |
1179: | |
1180: | return $this->performRequest($endpoint); |
1181: | } |
1182: | |
1183: | /** |
1184: | * Returns whether the cluster is running. |
1185: | * |
1186: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1187: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1188: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1189: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1190: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1191: | * |
1192: | * @param array $params Associative array of parameters |
1193: | * @return bool |
1194: | */ |
1195: | public function ping(array $params = []): bool |
1196: | { |
1197: | // manually make this verbose so we can check status code |
1198: | $params['client']['verbose'] = true; |
1199: | |
1200: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ping::class); |
1201: | $endpoint->setParams($params); |
1202: | |
1203: | return BooleanRequestWrapper::performRequest($endpoint, $this->transport); |
1204: | } |
1205: | |
1206: | /** |
1207: | * Creates or updates a script. |
1208: | * |
1209: | * $params['id'] = (string) Identifier for the stored script or search template. Must be unique within the cluster. (Required) |
1210: | * $params['context'] = (string) Context in which the script or search template should run. To prevent errors, the API immediately compiles the script or template in this context. |
1211: | * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node. |
1212: | * $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. |
1213: | * $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. |
1214: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1215: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1216: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1217: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1218: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1219: | * $params['body'] = (array) The document (Required) |
1220: | * |
1221: | * @param array $params Associative array of parameters |
1222: | * @return array |
1223: | */ |
1224: | public function putScript(array $params = []) |
1225: | { |
1226: | $id = $this->extractArgument($params, 'id'); |
1227: | $context = $this->extractArgument($params, 'context'); |
1228: | $body = $this->extractArgument($params, 'body'); |
1229: | |
1230: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\PutScript::class); |
1231: | $endpoint->setParams($params); |
1232: | $endpoint->setId($id); |
1233: | $endpoint->setContext($context); |
1234: | $endpoint->setBody($body); |
1235: | |
1236: | return $this->performRequest($endpoint); |
1237: | } |
1238: | |
1239: | /** |
1240: | * Allows to evaluate the quality of ranked search results over a set of typical search queries. |
1241: | * |
1242: | * $params['index'] = (array) Comma-separated list of data streams, indexes, and index aliases used to limit the request. Wildcard (`*`) expressions are supported. To target all data streams and indexes in a cluster, omit this parameter or use `_all` or `*`. |
1243: | * $params['allow_no_indices'] = (boolean) If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. |
1244: | * $params['expand_wildcards'] = (any) Whether to expand wildcard expression to concrete indexes that are open, closed or both. |
1245: | * $params['ignore_unavailable'] = (boolean) If `true`, missing or closed indexes are not included in the response. |
1246: | * $params['search_type'] = (enum) Search operation type (Options = dfs_query_then_fetch,query_then_fetch) |
1247: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1248: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1249: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1250: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1251: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1252: | * $params['body'] = (array) The ranking evaluation search definition, including search requests, document ratings and ranking metric definition. (Required) |
1253: | * |
1254: | * @param array $params Associative array of parameters |
1255: | * @return array |
1256: | */ |
1257: | public function rankEval(array $params = []) |
1258: | { |
1259: | $index = $this->extractArgument($params, 'index'); |
1260: | $body = $this->extractArgument($params, 'body'); |
1261: | |
1262: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\RankEval::class); |
1263: | $endpoint->setParams($params); |
1264: | $endpoint->setIndex($index); |
1265: | $endpoint->setBody($body); |
1266: | |
1267: | return $this->performRequest($endpoint); |
1268: | } |
1269: | |
1270: | /** |
1271: | * Allows to copy documents from one index to another, optionally filtering the sourcedocuments by a query, changing the destination index settings, or fetching thedocuments from a remote cluster. |
1272: | * |
1273: | * $params['max_docs'] = (integer) Maximum number of documents to process. By default, all documents. |
1274: | * $params['refresh'] = (boolean) If `true`, the request refreshes affected shards to make this operation visible to search. |
1275: | * $params['requests_per_second'] = (number) The throttle for this request in sub-requests per second.Defaults to no throttle. (Default = 0) |
1276: | * $params['scroll'] = (string) Specifies how long a consistent view of the index should be maintained for scrolled search. |
1277: | * $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. |
1278: | * $params['timeout'] = (string) Period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards. |
1279: | * $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`). |
1280: | * $params['wait_for_completion'] = (boolean) If `true`, the request blocks until the operation is complete. (Default = true) |
1281: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1282: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1283: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1284: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1285: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1286: | * $params['body'] = (array) The search definition using the Query DSL and the prototype for the index request. (Required) |
1287: | * |
1288: | * @param array $params Associative array of parameters |
1289: | * @return array |
1290: | */ |
1291: | public function reindex(array $params = []) |
1292: | { |
1293: | $body = $this->extractArgument($params, 'body'); |
1294: | |
1295: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Reindex::class); |
1296: | $endpoint->setParams($params); |
1297: | $endpoint->setBody($body); |
1298: | |
1299: | return $this->performRequest($endpoint); |
1300: | } |
1301: | |
1302: | /** |
1303: | * Changes the number of requests per second for a particular Reindex operation. |
1304: | * |
1305: | * $params['task_id'] = (string) Identifier for the task. (Required) |
1306: | * $params['requests_per_second'] = (number) The throttle for this request in sub-requests per second. |
1307: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1308: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1309: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1310: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1311: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1312: | * |
1313: | * @param array $params Associative array of parameters |
1314: | * @return array |
1315: | */ |
1316: | public function reindexRethrottle(array $params = []) |
1317: | { |
1318: | $task_id = $this->extractArgument($params, 'task_id'); |
1319: | |
1320: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\ReindexRethrottle::class); |
1321: | $endpoint->setParams($params); |
1322: | $endpoint->setTaskId($task_id); |
1323: | |
1324: | return $this->performRequest($endpoint); |
1325: | } |
1326: | |
1327: | /** |
1328: | * Allows to use the Mustache language to pre-render a search definition. |
1329: | * |
1330: | * $params['id'] = (string) ID of the search template to render. If no `source` is specified, this or the `id` request body parameter is required. |
1331: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1332: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1333: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1334: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1335: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1336: | * $params['body'] = (array) The search definition template and its params |
1337: | * |
1338: | * @param array $params Associative array of parameters |
1339: | * @return array |
1340: | */ |
1341: | public function renderSearchTemplate(array $params = []) |
1342: | { |
1343: | $id = $this->extractArgument($params, 'id'); |
1344: | $body = $this->extractArgument($params, 'body'); |
1345: | |
1346: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\RenderSearchTemplate::class); |
1347: | $endpoint->setParams($params); |
1348: | $endpoint->setId($id); |
1349: | $endpoint->setBody($body); |
1350: | |
1351: | return $this->performRequest($endpoint); |
1352: | } |
1353: | |
1354: | /** |
1355: | * Allows an arbitrary script to be executed and a result to be returned. |
1356: | * |
1357: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1358: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1359: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1360: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1361: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1362: | * $params['body'] = (array) The script to execute |
1363: | * |
1364: | * @param array $params Associative array of parameters |
1365: | * @return array |
1366: | */ |
1367: | public function scriptsPainlessExecute(array $params = []) |
1368: | { |
1369: | $body = $this->extractArgument($params, 'body'); |
1370: | |
1371: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\ScriptsPainlessExecute::class); |
1372: | $endpoint->setParams($params); |
1373: | $endpoint->setBody($body); |
1374: | |
1375: | return $this->performRequest($endpoint); |
1376: | } |
1377: | |
1378: | /** |
1379: | * Allows to retrieve a large numbers of results from a single search request. |
1380: | * |
1381: | * $params['scroll_id'] = DEPRECATED (string) The scroll ID |
1382: | * $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) |
1383: | * $params['scroll'] = (string) Period to retain the search context for scrolling. |
1384: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1385: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1386: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1387: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1388: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1389: | * $params['body'] = (array) The scroll ID if not passed by URL or query parameter. |
1390: | * |
1391: | * @param array $params Associative array of parameters |
1392: | * @return array |
1393: | */ |
1394: | public function scroll(array $params = []) |
1395: | { |
1396: | $scroll_id = $this->extractArgument($params, 'scroll_id'); |
1397: | $body = $this->extractArgument($params, 'body'); |
1398: | |
1399: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Scroll::class); |
1400: | $endpoint->setParams($params); |
1401: | $endpoint->setScrollId($scroll_id); |
1402: | $endpoint->setBody($body); |
1403: | |
1404: | return $this->performRequest($endpoint); |
1405: | } |
1406: | |
1407: | /** |
1408: | * Returns results matching a query. |
1409: | * |
1410: | * $params['index'] = (array) Comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (`*`). To search all data streams and indexes, omit this parameter or use `*` or `_all`. |
1411: | * $params['_source'] = (any) Indicates which source fields are returned for matching documents.These fields are returned in the `hits._source` property of the search response.Valid values are:`true` to return the entire document source;`false` to not return the document source;`<string>` to return the source fields that are specified as a comma-separated list (supports wildcard (`*`) patterns). |
1412: | * $params['_source_excludes'] = (any) A comma-separated list of source fields to exclude from the response.You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.If the `_source` parameter is `false`, this parameter is ignored. |
1413: | * $params['_source_includes'] = (any) A comma-separated list of source fields to include in the response.If this parameter is specified, only these source fields are returned.You can exclude fields from this subset using the `_source_excludes` query parameter.If the `_source` parameter is `false`, this parameter is ignored. |
1414: | * $params['allow_no_indices'] = (boolean) If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes.This behavior applies even if the request targets other open indexes.For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. |
1415: | * $params['allow_partial_search_results'] = (boolean) If true, returns partial results if there are shard request timeouts or shard failures. If false, returns an error with no partial results. (Default = true) |
1416: | * $params['analyze_wildcard'] = (boolean) If true, wildcard and prefix queries are analyzed.This parameter can only be used when the q query string parameter is specified. (Default = false) |
1417: | * $params['analyzer'] = (string) Analyzer to use for the query string.This parameter can only be used when the q query string parameter is specified. |
1418: | * $params['batched_reduce_size'] = (integer) The number of shard results that should be reduced at once on the coordinating node.This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. (Default = 512) |
1419: | * $params['cancel_after_time_interval'] = (string) The time after which the search request will be canceled.Request-level parameter takes precedence over `cancel_after_time_interval` cluster setting. |
1420: | * $params['ccs_minimize_roundtrips'] = (boolean) If true, network round-trips between the coordinating node and the remote clusters are minimized when executing cross-cluster search (CCS) requests. (Default = true) |
1421: | * $params['default_operator'] = (enum) The default operator for query string query: AND or OR.This parameter can only be used when the `q` query string parameter is specified. (Options = and,or) |
1422: | * $params['df'] = (string) Field to use as default where no field prefix is given in the query string.This parameter can only be used when the q query string parameter is specified. |
1423: | * $params['docvalue_fields'] = (any) A comma-separated list of fields to return as the docvalue representation for each hit. |
1424: | * $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`. |
1425: | * $params['explain'] = (boolean) If `true`, returns detailed information about score computation as part of a hit. |
1426: | * $params['from'] = (integer) Starting document offset.Needs to be non-negative.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 = 0) |
1427: | * $params['ignore_throttled'] = (boolean) If `true`, concrete, expanded or aliased indexes will be ignored when frozen. |
1428: | * $params['ignore_unavailable'] = (boolean) If `false`, the request returns an error if it targets a missing or closed index. |
1429: | * $params['include_named_queries_score'] = (boolean) Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false) (Default = false) |
1430: | * $params['lenient'] = (boolean) If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.This parameter can only be used when the `q` query string parameter is specified. |
1431: | * $params['max_concurrent_shard_requests'] = (integer) Defines the number of concurrent shard requests per node this search executes concurrently.This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. (Default = 5) |
1432: | * $params['phase_took'] = (boolean) Indicates whether to return phase-level `took` time values in the response. (Default = false) |
1433: | * $params['pre_filter_shard_size'] = (integer) 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 (if date filters are mandatory to match but the shard bounds and the query are disjoint).When unspecified, the pre-filter phase is executed if any of these conditions is met:the request targets more than 128 shards;the request targets one or more read-only index;the primary sort of the query targets an indexed field. |
1434: | * $params['preference'] = (string) Nodes and shards used for the search.By default, OpenSearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. Valid values are:`_only_local` to run the search only on shards on the local node;`_local` to, if possible, run the search on shards on the local node, or if not, select shards using the default method;`_only_nodes:<node-id>,<node-id>` to run the search on only the specified nodes IDs, where, if suitable shards exist on more than one selected node, use shards on those nodes using the default method, or if none of the specified nodes are available, select shards from any available node using the default method;`_prefer_nodes:<node-id>,<node-id>` to if possible, run the search on the specified nodes IDs, or if not, select shards using the default method;`_shards:<shard>,<shard>` to run the search only on the specified shards;`<custom-string>` (any string that does not start with `_`) to route searches with the same `<custom-string>` to the same shards in the same order. (Default = random) |
1435: | * $params['q'] = (string) Query in the Lucene query string syntax using query parameter search.Query parameter searches do not support the full OpenSearch Query DSL but are handy for testing. |
1436: | * $params['request_cache'] = (boolean) If `true`, the caching of search results is enabled for requests where `size` is `0`.Defaults to index level settings. |
1437: | * $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) |
1438: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
1439: | * $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. |
1440: | * $params['search_pipeline'] = (string) Customizable sequence of processing stages applied to search queries. |
1441: | * $params['search_type'] = (enum) How distributed term frequencies are calculated for relevance scoring. (Options = dfs_query_then_fetch,query_then_fetch) |
1442: | * $params['seq_no_primary_term'] = (boolean) If `true`, returns sequence number and primary term of the last modification of each hit. |
1443: | * $params['size'] = (integer) 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) |
1444: | * $params['sort'] = (any) A comma-separated list of <field>:<direction> pairs. |
1445: | * $params['stats'] = (array) Specific `tag` of the request for logging and statistical purposes. |
1446: | * $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. |
1447: | * $params['suggest_field'] = (string) Specifies which field to use for suggestions. |
1448: | * $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) |
1449: | * $params['suggest_size'] = (integer) Number of suggestions to return.This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. |
1450: | * $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. |
1451: | * $params['terminate_after'] = (integer) 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 indexes across multiple data tiers.If set to `0` (default), the query does not terminate early. |
1452: | * $params['timeout'] = (string) Specifies the period of time to wait for a response from each shard.If no response is received before the timeout expires, the request fails and returns an error. |
1453: | * $params['track_scores'] = (boolean) If `true`, calculate and return document scores, even if the scores are not used for sorting. |
1454: | * $params['track_total_hits'] = (any) Number of hits matching the query to count accurately.If `true`, the exact number of hits is returned at the cost of some performance.If `false`, the response does not include the total number of hits matching the query. |
1455: | * $params['typed_keys'] = (boolean) If `true`, aggregation and suggester names are be prefixed by their respective types in the response. |
1456: | * $params['version'] = (boolean) If `true`, returns document version as part of a hit. |
1457: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1458: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1459: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1460: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1461: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1462: | * $params['body'] = (array) The search definition using the Query DSL |
1463: | * |
1464: | * @param array $params Associative array of parameters |
1465: | * @return array |
1466: | */ |
1467: | public function search(array $params = []) |
1468: | { |
1469: | $index = $this->extractArgument($params, 'index'); |
1470: | $body = $this->extractArgument($params, 'body'); |
1471: | |
1472: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Search::class); |
1473: | $endpoint->setParams($params); |
1474: | $endpoint->setIndex($index); |
1475: | $endpoint->setBody($body); |
1476: | |
1477: | return $this->performRequest($endpoint); |
1478: | } |
1479: | |
1480: | /** |
1481: | * Returns information about the indexes and shards that a search request would be executed against. |
1482: | * |
1483: | * $params['index'] = (array) Returns the indexes and shards that a search request would be executed against. |
1484: | * $params['allow_no_indices'] = (boolean) If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes.This behavior applies even if the request targets other open indexes.For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. |
1485: | * $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`. |
1486: | * $params['ignore_unavailable'] = (boolean) If `false`, the request returns an error if it targets a missing or closed index. |
1487: | * $params['local'] = (boolean) If `true`, the request retrieves information from the local node only. (Default = false) |
1488: | * $params['preference'] = (string) Specifies the node or shard the operation should be performed on.Random by default. (Default = random) |
1489: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
1490: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1491: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1492: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1493: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1494: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1495: | * |
1496: | * @param array $params Associative array of parameters |
1497: | * @return array |
1498: | */ |
1499: | public function searchShards(array $params = []) |
1500: | { |
1501: | $index = $this->extractArgument($params, 'index'); |
1502: | |
1503: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\SearchShards::class); |
1504: | $endpoint->setParams($params); |
1505: | $endpoint->setIndex($index); |
1506: | |
1507: | return $this->performRequest($endpoint); |
1508: | } |
1509: | |
1510: | /** |
1511: | * Allows to use the Mustache language to pre-render a search definition. |
1512: | * |
1513: | * $params['index'] = (array) Comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (*). |
1514: | * $params['allow_no_indices'] = (boolean) If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes.This behavior applies even if the request targets other open indexes.For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. |
1515: | * $params['ccs_minimize_roundtrips'] = (boolean) If `true`, network round-trips are minimized for cross-cluster search requests. (Default = true) |
1516: | * $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`. |
1517: | * $params['explain'] = (boolean) If `true`, the response includes additional details about score computation as part of a hit. |
1518: | * $params['ignore_throttled'] = (boolean) If `true`, specified concrete, expanded, or aliased indexes are not included in the response when throttled. |
1519: | * $params['ignore_unavailable'] = (boolean) If `false`, the request returns an error if it targets a missing or closed index. |
1520: | * $params['preference'] = (string) Specifies the node or shard the operation should be performed on.Random by default. (Default = random) |
1521: | * $params['profile'] = (boolean) If `true`, the query execution is profiled. |
1522: | * $params['rest_total_hits_as_int'] = (boolean) If true, hits.total are rendered as an integer in the response. (Default = false) |
1523: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
1524: | * $params['scroll'] = (string) Specifies how long a consistent view of the indexshould be maintained for scrolled search. |
1525: | * $params['search_type'] = (enum) The type of the search operation. (Options = dfs_query_then_fetch,query_then_fetch) |
1526: | * $params['typed_keys'] = (boolean) If `true`, the response prefixes aggregation and suggester names with their respective types. |
1527: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1528: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1529: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1530: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1531: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1532: | * $params['body'] = (array) The search definition template and its params (Required) |
1533: | * |
1534: | * @param array $params Associative array of parameters |
1535: | * @return array |
1536: | */ |
1537: | public function searchTemplate(array $params = []) |
1538: | { |
1539: | $index = $this->extractArgument($params, 'index'); |
1540: | $body = $this->extractArgument($params, 'body'); |
1541: | |
1542: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\SearchTemplate::class); |
1543: | $endpoint->setParams($params); |
1544: | $endpoint->setIndex($index); |
1545: | $endpoint->setBody($body); |
1546: | |
1547: | return $this->performRequest($endpoint); |
1548: | } |
1549: | |
1550: | /** |
1551: | * Returns information and statistics about terms in the fields of a particular document. |
1552: | * |
1553: | * $params['index'] = (string) Name of the index that contains the document. (Required) |
1554: | * $params['id'] = (string) Unique identifier of the document. |
1555: | * $params['field_statistics'] = (boolean) If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies. (Default = true) |
1556: | * $params['fields'] = (any) Comma-separated list or wildcard expressions of fields to include in the statistics.Used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters. |
1557: | * $params['offsets'] = (boolean) If `true`, the response includes term offsets. (Default = true) |
1558: | * $params['payloads'] = (boolean) If `true`, the response includes term payloads. (Default = true) |
1559: | * $params['positions'] = (boolean) If `true`, the response includes term positions. (Default = true) |
1560: | * $params['preference'] = (string) Specifies the node or shard the operation should be performed on.Random by default. (Default = random) |
1561: | * $params['realtime'] = (boolean) If true, the request is real-time as opposed to near-real-time. (Default = true) |
1562: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
1563: | * $params['term_statistics'] = (boolean) If `true`, the response includes term frequency and document frequency. (Default = false) |
1564: | * $params['version'] = (integer) If `true`, returns the document version as part of a hit. |
1565: | * $params['version_type'] = (enum) Specific version type. (Options = external,external_gte,force,internal) |
1566: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1567: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1568: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1569: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1570: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1571: | * $params['body'] = (array) Define parameters and or supply a document to get termvectors for. See documentation. |
1572: | * |
1573: | * @param array $params Associative array of parameters |
1574: | * @return array |
1575: | */ |
1576: | public function termvectors(array $params = []) |
1577: | { |
1578: | $index = $this->extractArgument($params, 'index'); |
1579: | $id = $this->extractArgument($params, 'id'); |
1580: | $body = $this->extractArgument($params, 'body'); |
1581: | |
1582: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\TermVectors::class); |
1583: | $endpoint->setParams($params); |
1584: | $endpoint->setIndex($index); |
1585: | $endpoint->setId($id); |
1586: | $endpoint->setBody($body); |
1587: | |
1588: | return $this->performRequest($endpoint); |
1589: | } |
1590: | |
1591: | /** |
1592: | * Updates a document with a script or partial document. |
1593: | * |
1594: | * $params['id'] = (string) Document ID (Required) |
1595: | * $params['index'] = (string) The name of the index (Required) |
1596: | * $params['_source'] = (any) Set to false to disable source retrieval. You can also specify a comma-separatedlist of the fields you want to retrieve. |
1597: | * $params['_source_excludes'] = (any) Specify the source fields you want to exclude. |
1598: | * $params['_source_includes'] = (any) Specify the source fields you want to retrieve. |
1599: | * $params['if_primary_term'] = (integer) Only perform the operation if the document has this primary term. |
1600: | * $params['if_seq_no'] = (integer) Only perform the operation if the document has this sequence number. |
1601: | * $params['lang'] = (string) The script language. (Default = painless) |
1602: | * $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) |
1603: | * $params['require_alias'] = (boolean) If true, the destination must be an index alias. (Default = false) |
1604: | * $params['retry_on_conflict'] = (integer) Specify how many times should the operation be retried when a conflict occurs. (Default = 0) |
1605: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
1606: | * $params['timeout'] = (string) Period to wait for dynamic mapping updates and active shards.This guarantees OpenSearch waits for at least the timeout before failing.The actual wait time could be longer, particularly when multiple waits occur. |
1607: | * $params['wait_for_active_shards'] = (any) The number of shard copies that must be active before proceeding with the operations.Set to 'all' or any positive integer up to the total number of shards in the index(number_of_replicas+1). Defaults to 1 meaning the primary shard. |
1608: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1609: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1610: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1611: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1612: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1613: | * $params['body'] = (array) The request definition requires either `script` or partial `doc` (Required) |
1614: | * |
1615: | * @param array $params Associative array of parameters |
1616: | * @return array |
1617: | */ |
1618: | public function update(array $params = []) |
1619: | { |
1620: | $id = $this->extractArgument($params, 'id'); |
1621: | $index = $this->extractArgument($params, 'index'); |
1622: | $body = $this->extractArgument($params, 'body'); |
1623: | |
1624: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Update::class); |
1625: | $endpoint->setParams($params); |
1626: | $endpoint->setId($id); |
1627: | $endpoint->setIndex($index); |
1628: | $endpoint->setBody($body); |
1629: | |
1630: | return $this->performRequest($endpoint); |
1631: | } |
1632: | |
1633: | /** |
1634: | * Performs an update on every document in the index without changing the source,for example to pick up a mapping change. |
1635: | * |
1636: | * $params['index'] = (array) Comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (`*`). To search all data streams or indexes, omit this parameter or use `*` or `_all`. (Required) |
1637: | * $params['_source'] = (array) True or false to return the _source field or not, or a list of fields to return. |
1638: | * $params['_source_excludes'] = (array) List of fields to exclude from the returned _source field. |
1639: | * $params['_source_includes'] = (array) List of fields to extract and return from the _source field. |
1640: | * $params['allow_no_indices'] = (boolean) If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes.This behavior applies even if the request targets other open indexes.For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. |
1641: | * $params['analyze_wildcard'] = (boolean) If `true`, wildcard and prefix queries are analyzed. (Default = false) |
1642: | * $params['analyzer'] = (string) Analyzer to use for the query string. |
1643: | * $params['conflicts'] = (enum) What to do if update by query hits version conflicts: `abort` or `proceed`. (Options = abort,proceed) |
1644: | * $params['default_operator'] = (enum) The default operator for query string query: `AND` or `OR`. (Options = and,or) |
1645: | * $params['df'] = (string) Field to use as default where no field prefix is given in the query string. |
1646: | * $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`. |
1647: | * $params['from'] = (integer) Starting offset. (Default = 0) |
1648: | * $params['ignore_unavailable'] = (boolean) If `false`, the request returns an error if it targets a missing or closed index. |
1649: | * $params['lenient'] = (boolean) If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. |
1650: | * $params['max_docs'] = (integer) Maximum number of documents to process.Defaults to all documents. |
1651: | * $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. |
1652: | * $params['preference'] = (string) Specifies the node or shard the operation should be performed on.Random by default. (Default = random) |
1653: | * $params['q'] = (string) Query in the Lucene query string syntax. |
1654: | * $params['refresh'] = (boolean) If `true`, OpenSearch refreshes affected shards to make the operation visible to search. |
1655: | * $params['request_cache'] = (boolean) If `true`, the request cache is used for this request. |
1656: | * $params['requests_per_second'] = (number) The throttle for this request in sub-requests per second. (Default = 0) |
1657: | * $params['routing'] = (any) Custom value used to route operations to a specific shard. |
1658: | * $params['scroll'] = (string) Period to retain the search context for scrolling. |
1659: | * $params['scroll_size'] = (integer) Size of the scroll request that powers the operation. (Default = 100) |
1660: | * $params['search_timeout'] = (string) Explicit timeout for each search request. |
1661: | * $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) |
1662: | * $params['size'] = (integer) Deprecated, please use `max_docs` instead. |
1663: | * $params['slices'] = (any) The number of slices this task should be divided into. |
1664: | * $params['sort'] = (array) A comma-separated list of <field>:<direction> pairs. |
1665: | * $params['stats'] = (array) Specific `tag` of the request for logging and statistical purposes. |
1666: | * $params['terminate_after'] = (integer) 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 indexes across multiple data tiers. |
1667: | * $params['timeout'] = (string) Period each update request waits for the following operations: dynamic mapping updates, waiting for active shards. |
1668: | * $params['version'] = (boolean) If `true`, returns the document version as part of a hit. |
1669: | * $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`). |
1670: | * $params['wait_for_completion'] = (boolean) If `true`, the request blocks until the operation is complete. (Default = true) |
1671: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1672: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1673: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1674: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1675: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1676: | * $params['body'] = (array) The search definition using the Query DSL |
1677: | * |
1678: | * @param array $params Associative array of parameters |
1679: | * @return array |
1680: | */ |
1681: | public function updateByQuery(array $params = []) |
1682: | { |
1683: | $index = $this->extractArgument($params, 'index'); |
1684: | $body = $this->extractArgument($params, 'body'); |
1685: | |
1686: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\UpdateByQuery::class); |
1687: | $endpoint->setParams($params); |
1688: | $endpoint->setIndex($index); |
1689: | $endpoint->setBody($body); |
1690: | |
1691: | return $this->performRequest($endpoint); |
1692: | } |
1693: | |
1694: | /** |
1695: | * Changes the number of requests per second for a particular Update By Query operation. |
1696: | * |
1697: | * $params['task_id'] = (string) The ID for the task. (Required) |
1698: | * $params['requests_per_second'] = (number) The throttle for this request in sub-requests per second. |
1699: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
1700: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
1701: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
1702: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1703: | * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". |
1704: | * |
1705: | * @param array $params Associative array of parameters |
1706: | * @return array |
1707: | */ |
1708: | public function updateByQueryRethrottle(array $params = []) |
1709: | { |
1710: | $task_id = $this->extractArgument($params, 'task_id'); |
1711: | |
1712: | $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\UpdateByQueryRethrottle::class); |
1713: | $endpoint->setParams($params); |
1714: | $endpoint->setTaskId($task_id); |
1715: | |
1716: | return $this->performRequest($endpoint); |
1717: | } |
1718: | |
1719: | /** |
1720: | * Proxy function to createPointInTime() to prevent BC break. |
1721: | * This API will be removed in a future version. Use 'createPit' API instead. |
1722: | */ |
1723: | public function createPointInTime(array $params = []) |
1724: | { |
1725: | return $this->createPit($params); |
1726: | } |
1727: | /** |
1728: | * Creates a new document in the index.Returns a 409 response when a document with a same ID already exists in the index. |
1729: | * |
1730: | * $params['id'] = (string) Unique identifier for the document. (Required) |
1731: | * $params['index'] = (string) Name of the data stream or index to target. If the target doesn’t exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. If the target doesn’t exist and doesn’t match a data stream template, this request creates the index. (Required) |
1732: | * $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. |
1733: | * $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) |
1734: | * $params['routing'] = (string) Custom value used to route operations to a specific shard. |
1735: | * $params['timeout'] = (string) Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. |
1736: | * $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. |
1737: | * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = internal,external,external_gte,force) |
1738: | * $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`). |
1739: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. |
1740: | * $params['human'] = (boolean) Whether to return human readable values for statistics. |
1741: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. |
1742: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
1743: | * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. |
1744: | * $params['body'] = (array) The document (Required) |
1745: | * |
1746: | * @param array $params Associative array of parameters |
1747: | * @return array |
1748: | */ |
1749: | public function create(array $params = []) |
1750: | { |
1751: | $id = $this->extractArgument($params, 'id'); |
1752: | $index = $this->extractArgument($params, 'index'); |
1753: | $body = $this->extractArgument($params, 'body'); |
1754: | |
1755: | $endpoint = $id ? |
1756: | $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Create::class) |
1757: | : $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Index::class); |
1758: | $endpoint->setParams($params); |
1759: | $endpoint->setId($id); |
1760: | $endpoint->setIndex($index); |
1761: | $endpoint->setBody($body); |
1762: | |
1763: | return $this->performRequest($endpoint); |
1764: | } |
1765: | /** |
1766: | * Proxy function to deletePointInTime() to prevent BC break. |
1767: | * This API will be removed in a future version. Use 'deletePit' API instead. |
1768: | */ |
1769: | public function deletePointInTime(array $params = []) |
1770: | { |
1771: | return $this->deletePit($params); |
1772: | } |
1773: | /** |
1774: | * Returns the asyncSearch namespace |
1775: | */ |
1776: | public function asyncSearch(): AsyncSearchNamespace |
1777: | { |
1778: | return $this->asyncSearch; |
1779: | } |
1780: | /** |
1781: | * Returns the asynchronousSearch namespace |
1782: | */ |
1783: | public function asynchronousSearch(): AsynchronousSearchNamespace |
1784: | { |
1785: | return $this->asynchronousSearch; |
1786: | } |
1787: | /** |
1788: | * Returns the cat namespace |
1789: | */ |
1790: | public function cat(): CatNamespace |
1791: | { |
1792: | return $this->cat; |
1793: | } |
1794: | /** |
1795: | * Returns the cluster namespace |
1796: | */ |
1797: | public function cluster(): ClusterNamespace |
1798: | { |
1799: | return $this->cluster; |
1800: | } |
1801: | /** |
1802: | * Returns the danglingIndices namespace |
1803: | */ |
1804: | public function danglingIndices(): DanglingIndicesNamespace |
1805: | { |
1806: | return $this->danglingIndices; |
1807: | } |
1808: | /** |
1809: | * Returns the dataFrameTransformDeprecated namespace |
1810: | */ |
1811: | public function dataFrameTransformDeprecated(): DataFrameTransformDeprecatedNamespace |
1812: | { |
1813: | return $this->dataFrameTransformDeprecated; |
1814: | } |
1815: | /** |
1816: | * Returns the flowFramework namespace |
1817: | */ |
1818: | public function flowFramework(): FlowFrameworkNamespace |
1819: | { |
1820: | return $this->flowFramework; |
1821: | } |
1822: | /** |
1823: | * Returns the indices namespace |
1824: | */ |
1825: | public function indices(): IndicesNamespace |
1826: | { |
1827: | return $this->indices; |
1828: | } |
1829: | /** |
1830: | * Returns the ingest namespace |
1831: | */ |
1832: | public function ingest(): IngestNamespace |
1833: | { |
1834: | return $this->ingest; |
1835: | } |
1836: | /** |
1837: | * Returns the insights namespace |
1838: | */ |
1839: | public function insights(): InsightsNamespace |
1840: | { |
1841: | return $this->insights; |
1842: | } |
1843: | /** |
1844: | * Returns the ism namespace |
1845: | */ |
1846: | public function ism(): IsmNamespace |
1847: | { |
1848: | return $this->ism; |
1849: | } |
1850: | /** |
1851: | * Returns the knn namespace |
1852: | */ |
1853: | public function knn(): KnnNamespace |
1854: | { |
1855: | return $this->knn; |
1856: | } |
1857: | /** |
1858: | * Returns the list namespace |
1859: | */ |
1860: | public function list(): ListNamespace |
1861: | { |
1862: | return $this->list; |
1863: | } |
1864: | /** |
1865: | * Returns the ml namespace |
1866: | */ |
1867: | public function ml(): MlNamespace |
1868: | { |
1869: | return $this->ml; |
1870: | } |
1871: | /** |
1872: | * Returns the monitoring namespace |
1873: | */ |
1874: | public function monitoring(): MonitoringNamespace |
1875: | { |
1876: | return $this->monitoring; |
1877: | } |
1878: | /** |
1879: | * Returns the nodes namespace |
1880: | */ |
1881: | public function nodes(): NodesNamespace |
1882: | { |
1883: | return $this->nodes; |
1884: | } |
1885: | /** |
1886: | * Returns the notifications namespace |
1887: | */ |
1888: | public function notifications(): NotificationsNamespace |
1889: | { |
1890: | return $this->notifications; |
1891: | } |
1892: | /** |
1893: | * Returns the observability namespace |
1894: | */ |
1895: | public function observability(): ObservabilityNamespace |
1896: | { |
1897: | return $this->observability; |
1898: | } |
1899: | /** |
1900: | * Returns the ppl namespace |
1901: | */ |
1902: | public function ppl(): PplNamespace |
1903: | { |
1904: | return $this->ppl; |
1905: | } |
1906: | /** |
1907: | * Returns the query namespace |
1908: | */ |
1909: | public function query(): QueryNamespace |
1910: | { |
1911: | return $this->query; |
1912: | } |
1913: | /** |
1914: | * Returns the remoteStore namespace |
1915: | */ |
1916: | public function remoteStore(): RemoteStoreNamespace |
1917: | { |
1918: | return $this->remoteStore; |
1919: | } |
1920: | /** |
1921: | * Returns the rollups namespace |
1922: | */ |
1923: | public function rollups(): RollupsNamespace |
1924: | { |
1925: | return $this->rollups; |
1926: | } |
1927: | /** |
1928: | * Returns the searchPipeline namespace |
1929: | */ |
1930: | public function searchPipeline(): SearchPipelineNamespace |
1931: | { |
1932: | return $this->searchPipeline; |
1933: | } |
1934: | /** |
1935: | * Returns the searchableSnapshots namespace |
1936: | */ |
1937: | public function searchableSnapshots(): SearchableSnapshotsNamespace |
1938: | { |
1939: | return $this->searchableSnapshots; |
1940: | } |
1941: | /** |
1942: | * Returns the security namespace |
1943: | */ |
1944: | public function security(): SecurityNamespace |
1945: | { |
1946: | return $this->security; |
1947: | } |
1948: | /** |
1949: | * Returns the snapshot namespace |
1950: | */ |
1951: | public function snapshot(): SnapshotNamespace |
1952: | { |
1953: | return $this->snapshot; |
1954: | } |
1955: | /** |
1956: | * Returns the sql namespace |
1957: | */ |
1958: | public function sql(): SqlNamespace |
1959: | { |
1960: | return $this->sql; |
1961: | } |
1962: | /** |
1963: | * Returns the ssl namespace |
1964: | */ |
1965: | public function ssl(): SslNamespace |
1966: | { |
1967: | return $this->ssl; |
1968: | } |
1969: | /** |
1970: | * Returns the tasks namespace |
1971: | */ |
1972: | public function tasks(): TasksNamespace |
1973: | { |
1974: | return $this->tasks; |
1975: | } |
1976: | /** |
1977: | * Returns the transforms namespace |
1978: | */ |
1979: | public function transforms(): TransformsNamespace |
1980: | { |
1981: | return $this->transforms; |
1982: | } |
1983: | /** |
1984: | * Returns the wlm namespace |
1985: | */ |
1986: | public function wlm(): WlmNamespace |
1987: | { |
1988: | return $this->wlm; |
1989: | } |
1990: | |
1991: | |
1992: | /** |
1993: | * Gets the endpoint factory. |
1994: | */ |
1995: | protected function getEndpointFactory(): EndpointFactoryInterface |
1996: | { |
1997: | return $this->endpointFactory; |
1998: | } |
1999: | |
2000: | /** |
2001: | * Catchall for registered namespaces |
2002: | * |
2003: | * @return object |
2004: | * @throws BadMethodCallException if the namespace cannot be found |
2005: | */ |
2006: | public function __call(string $name, array $arguments) |
2007: | { |
2008: | if (isset($this->registeredNamespaces[$name])) { |
2009: | return $this->registeredNamespaces[$name]; |
2010: | } |
2011: | throw new BadMethodCallException("Namespace [$name] not found"); |
2012: | } |
2013: | |
2014: | /** |
2015: | * Extract an argument from the array of parameters |
2016: | * |
2017: | * @return null|mixed |
2018: | */ |
2019: | public function extractArgument(array &$params, string $arg) |
2020: | { |
2021: | if (array_key_exists($arg, $params) === true) { |
2022: | $value = $params[$arg]; |
2023: | $value = (is_object($value) && !is_iterable($value)) ? |
2024: | (array) $value : |
2025: | $value; |
2026: | unset($params[$arg]); |
2027: | return $value; |
2028: | } else { |
2029: | return null; |
2030: | } |
2031: | } |
2032: | |
2033: | /** |
2034: | * Sends a raw request to the cluster |
2035: | * @return callable|array |
2036: | * @throws NoNodesAvailableException |
2037: | */ |
2038: | public function request(string $method, string $uri, array $attributes = []) |
2039: | { |
2040: | $params = $attributes['params'] ?? []; |
2041: | $body = $attributes['body'] ?? null; |
2042: | $options = $attributes['options'] ?? []; |
2043: | |
2044: | $promise = $this->transport->performRequest($method, $uri, $params, $body, $options); |
2045: | |
2046: | return $this->transport->resultOrFuture($promise, $options); |
2047: | } |
2048: | |
2049: | /** |
2050: | * @return callable|array |
2051: | */ |
2052: | private function performRequest(AbstractEndpoint $endpoint) |
2053: | { |
2054: | $promise = $this->transport->performRequest( |
2055: | $endpoint->getMethod(), |
2056: | $endpoint->getURI(), |
2057: | $endpoint->getParams(), |
2058: | $endpoint->getBody(), |
2059: | $endpoint->getOptions() |
2060: | ); |
2061: | |
2062: | return $this->transport->resultOrFuture($promise, $endpoint->getOptions()); |
2063: | } |
2064: | } |
2065: |