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\Endpoints;
23:
24: use OpenSearch\Endpoints\AbstractEndpoint;
25:
26: /**
27: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
28: */
29: class Search extends AbstractEndpoint
30: {
31: public function getURI(): string
32: {
33: $index = $this->index ?? null;
34: if (isset($index)) {
35: return "/$index/_search";
36: }
37: return "/_search";
38: }
39:
40: public function getParamWhitelist(): array
41: {
42: return [
43: '_source',
44: '_source_excludes',
45: '_source_includes',
46: 'allow_no_indices',
47: 'allow_partial_search_results',
48: 'analyze_wildcard',
49: 'analyzer',
50: 'batched_reduce_size',
51: 'cancel_after_time_interval',
52: 'ccs_minimize_roundtrips',
53: 'default_operator',
54: 'df',
55: 'docvalue_fields',
56: 'expand_wildcards',
57: 'explain',
58: 'from',
59: 'ignore_throttled',
60: 'ignore_unavailable',
61: 'include_named_queries_score',
62: 'lenient',
63: 'max_concurrent_shard_requests',
64: 'phase_took',
65: 'pre_filter_shard_size',
66: 'preference',
67: 'q',
68: 'request_cache',
69: 'rest_total_hits_as_int',
70: 'routing',
71: 'scroll',
72: 'search_pipeline',
73: 'search_type',
74: 'seq_no_primary_term',
75: 'size',
76: 'sort',
77: 'stats',
78: 'stored_fields',
79: 'suggest_field',
80: 'suggest_mode',
81: 'suggest_size',
82: 'suggest_text',
83: 'terminate_after',
84: 'timeout',
85: 'track_scores',
86: 'track_total_hits',
87: 'typed_keys',
88: 'version',
89: 'pretty',
90: 'human',
91: 'error_trace',
92: 'source',
93: 'filter_path'
94: ];
95: }
96:
97: public function getMethod(): string
98: {
99: return isset($this->body) ? 'POST' : 'GET';
100: }
101:
102: public function setBody($body): static
103: {
104: if (isset($body) !== true) {
105: return $this;
106: }
107: $this->body = $body;
108:
109: return $this;
110: }
111: }
112: