SearchShards.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace Elasticsearch\Endpoints;
  3. /**
  4. * Class Search
  5. *
  6. * @category Elasticsearch
  7. * @package Elasticsearch\Endpoints
  8. * @author Zachary Tong <zach@elastic.co>
  9. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
  10. * @link http://elastic.co
  11. */
  12. class SearchShards extends AbstractEndpoint
  13. {
  14. /**
  15. * @return string
  16. */
  17. public function getURI()
  18. {
  19. $index = $this->index;
  20. $type = $this->type;
  21. $uri = "/_search_shards";
  22. if (isset($index) === true && isset($type) === true) {
  23. $uri = "/$index/$type/_search_shards";
  24. } elseif (isset($index) === true) {
  25. $uri = "/$index/_search_shards";
  26. } elseif (isset($type) === true) {
  27. $uri = "/_all/$type/_search_shards";
  28. }
  29. return $uri;
  30. }
  31. /**
  32. * @return string[]
  33. */
  34. public function getParamWhitelist()
  35. {
  36. return array(
  37. 'preference',
  38. 'routing',
  39. 'local',
  40. 'ignore_unavailable',
  41. 'allow_no_indices',
  42. 'expand_wildcards'
  43. );
  44. }
  45. /**
  46. * @return string
  47. */
  48. public function getMethod()
  49. {
  50. return 'GET';
  51. }
  52. }