index) !== true) { throw new RuntimeException( 'index is required for create' ); } $index = $this->index; if (isset($this->id) !== true) { return "/$index/_doc"; } return "/$index/_create/$this->id"; } public function getParamWhitelist(): array { return [ 'wait_for_active_shards', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'pipeline' ]; } public function getMethod(): string { return isset($this->id) ? 'PUT' : 'POST'; } public function setBody($body): Create { if (isset($body) !== true) { return $this; } $this->body = $body; return $this; } }