| 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\Cat; |
| 23: | |
| 24: | use OpenSearch\Endpoints\AbstractEndpoint; |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | class Fielddata extends AbstractEndpoint |
| 30: | { |
| 31: | protected $fields; |
| 32: | |
| 33: | public function getURI(): string |
| 34: | { |
| 35: | $fields = $this->fields ?? null; |
| 36: | if (isset($fields)) { |
| 37: | return '/_cat/fielddata/' . rawurlencode($fields); |
| 38: | } |
| 39: | return '/_cat/fielddata'; |
| 40: | } |
| 41: | |
| 42: | public function getParamWhitelist(): array |
| 43: | { |
| 44: | return [ |
| 45: | 'bytes', |
| 46: | 'fields', |
| 47: | 'format', |
| 48: | 'h', |
| 49: | 'help', |
| 50: | 's', |
| 51: | 'v', |
| 52: | 'pretty', |
| 53: | 'human', |
| 54: | 'error_trace', |
| 55: | 'source', |
| 56: | 'filter_path' |
| 57: | ]; |
| 58: | } |
| 59: | |
| 60: | public function getMethod(): string |
| 61: | { |
| 62: | return 'GET'; |
| 63: | } |
| 64: | |
| 65: | public function setFields($fields): static |
| 66: | { |
| 67: | if (isset($fields) !== true) { |
| 68: | return $this; |
| 69: | } |
| 70: | if (is_array($fields) === true) { |
| 71: | $fields = implode(",", $fields); |
| 72: | } |
| 73: | $this->fields = $fields; |
| 74: | |
| 75: | return $this; |
| 76: | } |
| 77: | } |
| 78: | |