| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace Elasticsearch\Endpoints;
- use Elasticsearch\Common\Exceptions;
- /**
- * Class Exists
- *
- * @category Elasticsearch
- * @package Elasticsearch\Endpoints
- * @author Zachary Tong <zach@elastic.co>
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
- * @link http://elastic.co
- */
- class Exists extends AbstractEndpoint
- {
- /**
- * @throws \Elasticsearch\Common\Exceptions\RuntimeException
- * @return string
- */
- public function getURI()
- {
- if (isset($this->id) !== true) {
- throw new Exceptions\RuntimeException(
- 'id is required for Exists'
- );
- }
- if (isset($this->index) !== true) {
- throw new Exceptions\RuntimeException(
- 'index is required for Exists'
- );
- }
- if (isset($this->type) !== true) {
- throw new Exceptions\RuntimeException(
- 'type is required for Exists'
- );
- }
- $id = $this->id;
- $index = $this->index;
- $type = $this->type;
- $uri = "/$index/$type/$id";
- if (isset($index) === true && isset($type) === true && isset($id) === true) {
- $uri = "/$index/$type/$id";
- }
- return $uri;
- }
- /**
- * @return string[]
- */
- public function getParamWhitelist()
- {
- return array(
- 'parent',
- 'preference',
- 'realtime',
- 'refresh',
- 'routing',
- 'version',
- 'stored_fields'
- );
- }
- /**
- * @return string
- */
- public function getMethod()
- {
- return 'HEAD';
- }
- }
|