ClearCache.php 1.2 KB

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