FieldCaps.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Elasticsearch\Endpoints;
  3. use Elasticsearch\Common\Exceptions\InvalidArgumentException;
  4. use Elasticsearch\Common\Exceptions;
  5. /**
  6. * Class FieldCaps
  7. *
  8. * @category Elasticsearch
  9. * @package Elasticsearch\Endpoints
  10. * @author Zachary Tong <zach@elastic.co>
  11. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
  12. * @link http://elastic.co
  13. */
  14. class FieldCaps extends AbstractEndpoint
  15. {
  16. /**
  17. * @param array $body
  18. *
  19. * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException
  20. * @return $this
  21. */
  22. public function setBody($body)
  23. {
  24. if (isset($body) !== true) {
  25. return $this;
  26. }
  27. $this->body = $body;
  28. return $this;
  29. }
  30. /**
  31. * @return string
  32. */
  33. public function getURI()
  34. {
  35. $index = $this->index;
  36. if (isset($index) === true) {
  37. return "/$index/_field_caps";
  38. } else {
  39. return "/_field_caps";
  40. }
  41. }
  42. /**
  43. * @return string[]
  44. */
  45. public function getParamWhitelist()
  46. {
  47. return array(
  48. 'fields',
  49. 'ignore_unavailable',
  50. 'allow_no_indices',
  51. 'expand_wildcards'
  52. );
  53. }
  54. /**
  55. * @return string
  56. */
  57. public function getMethod()
  58. {
  59. return 'GET';
  60. }
  61. }