1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: | |
16: | |
17: | |
18: | |
19: | |
20: | |
21: | |
22: | namespace OpenSearch\Endpoints; |
23: | |
24: | |
25: | |
26: | |
27: | class Mget extends AbstractEndpoint |
28: | { |
29: | public function getURI(): string |
30: | { |
31: | $index = $this->index ?? null; |
32: | if (isset($index)) { |
33: | return "/$index/_mget"; |
34: | } |
35: | return "/_mget"; |
36: | } |
37: | |
38: | public function getParamWhitelist(): array |
39: | { |
40: | return [ |
41: | '_source', |
42: | '_source_excludes', |
43: | '_source_includes', |
44: | 'preference', |
45: | 'realtime', |
46: | 'refresh', |
47: | 'routing', |
48: | 'stored_fields', |
49: | 'pretty', |
50: | 'human', |
51: | 'error_trace', |
52: | 'source', |
53: | 'filter_path' |
54: | ]; |
55: | } |
56: | |
57: | public function getMethod(): string |
58: | { |
59: | return isset($this->body) ? 'POST' : 'GET'; |
60: | } |
61: | |
62: | public function setBody($body): static |
63: | { |
64: | if (is_null($body)) { |
65: | return $this; |
66: | } |
67: | $this->body = $body; |
68: | |
69: | return $this; |
70: | } |
71: | } |
72: | |