1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: | |
16: | namespace OpenSearch\Endpoints\Knn; |
17: | |
18: | use OpenSearch\Endpoints\AbstractEndpoint; |
19: | |
20: | |
21: | |
22: | |
23: | class SearchModels extends AbstractEndpoint |
24: | { |
25: | public function getURI(): string |
26: | { |
27: | return "/_plugins/_knn/models/_search"; |
28: | } |
29: | |
30: | public function getParamWhitelist(): array |
31: | { |
32: | return [ |
33: | '_source', |
34: | '_source_excludes', |
35: | '_source_includes', |
36: | 'allow_no_indices', |
37: | 'allow_partial_search_results', |
38: | 'analyze_wildcard', |
39: | 'analyzer', |
40: | 'batched_reduce_size', |
41: | 'ccs_minimize_roundtrips', |
42: | 'default_operator', |
43: | 'df', |
44: | 'docvalue_fields', |
45: | 'expand_wildcards', |
46: | 'explain', |
47: | 'from', |
48: | 'ignore_throttled', |
49: | 'ignore_unavailable', |
50: | 'lenient', |
51: | 'max_concurrent_shard_requests', |
52: | 'pre_filter_shard_size', |
53: | 'preference', |
54: | 'q', |
55: | 'request_cache', |
56: | 'rest_total_hits_as_int', |
57: | 'routing', |
58: | 'scroll', |
59: | 'search_type', |
60: | 'seq_no_primary_term', |
61: | 'size', |
62: | 'sort', |
63: | 'stats', |
64: | 'stored_fields', |
65: | 'suggest_field', |
66: | 'suggest_mode', |
67: | 'suggest_size', |
68: | 'suggest_text', |
69: | 'terminate_after', |
70: | 'timeout', |
71: | 'track_scores', |
72: | 'track_total_hits', |
73: | 'typed_keys', |
74: | 'version', |
75: | 'pretty', |
76: | 'human', |
77: | 'error_trace', |
78: | 'source', |
79: | 'filter_path' |
80: | ]; |
81: | } |
82: | |
83: | public function getMethod(): string |
84: | { |
85: | return isset($this->body) ? 'POST' : 'GET'; |
86: | } |
87: | |
88: | public function setBody($body): static |
89: | { |
90: | if (isset($body) !== true) { |
91: | return $this; |
92: | } |
93: | $this->body = $body; |
94: | |
95: | return $this; |
96: | } |
97: | } |
98: | |