Delete.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace Elasticsearch\Endpoints\Indices\Mapping;
  3. use Elasticsearch\Endpoints\AbstractEndpoint;
  4. use Elasticsearch\Common\Exceptions;
  5. /**
  6. * Class Delete
  7. *
  8. * @category Elasticsearch
  9. * @package Elasticsearch\Endpoints\Indices\Mapping
  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 Delete extends AbstractEndpoint
  15. {
  16. /**
  17. * @throws \Elasticsearch\Common\Exceptions\RuntimeException
  18. * @return string
  19. */
  20. public function getURI()
  21. {
  22. if (isset($this->index) !== true) {
  23. throw new Exceptions\RuntimeException(
  24. 'index is required for Delete'
  25. );
  26. }
  27. if (isset($this->type) !== true) {
  28. throw new Exceptions\RuntimeException(
  29. 'type is required for Delete'
  30. );
  31. }
  32. $index = $this->index;
  33. $type = $this->type;
  34. $uri = "/$index/$type/_mapping";
  35. if (isset($index) === true && isset($type) === true) {
  36. $uri = "/$index/$type/_mapping";
  37. }
  38. return $uri;
  39. }
  40. /**
  41. * @return string[]
  42. */
  43. public function getParamWhitelist()
  44. {
  45. return array(
  46. 'master_timeout',
  47. );
  48. }
  49. /**
  50. * @return string
  51. */
  52. public function getMethod()
  53. {
  54. return 'DELETE';
  55. }
  56. }