| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace Elasticsearch\Endpoints\Indices;
- use Elasticsearch\Endpoints\AbstractEndpoint;
- use Elasticsearch\Common\Exceptions;
- /**
- * Class Create
- *
- * @category Elasticsearch
- * @package Elasticsearch\Endpoints\Indices
- * @author Zachary Tong <zach@elastic.co>
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
- * @link http://elastic.co
- */
- class Create extends AbstractEndpoint
- {
- /**
- * @param array|object $body
- *
- * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException
- * @return $this
- */
- public function setBody($body)
- {
- if (isset($body) !== true) {
- return $this;
- }
- $this->body = $body;
- return $this;
- }
- /**
- * @throws \Elasticsearch\Common\Exceptions\RuntimeException
- * @return string
- */
- public function getURI()
- {
- if (isset($this->index) !== true) {
- throw new Exceptions\RuntimeException(
- 'index is required for Create'
- );
- }
- $index = $this->index;
- $uri = "/$index";
- if (isset($index) === true) {
- $uri = "/$index";
- }
- return $uri;
- }
- /**
- * @return string[]
- */
- public function getParamWhitelist()
- {
- return array(
- 'timeout',
- 'master_timeout',
- 'update_all_types',
- 'wait_for_active_shards'
- );
- }
- /**
- * @return string
- */
- public function getMethod()
- {
- return 'PUT';
- }
- }
|