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