We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b87954 commit adcaa2cCopy full SHA for adcaa2c
src/Elasticsearch/Endpoints/Indices/Create.php
@@ -17,7 +17,7 @@
17
class Create extends AbstractEndpoint
18
{
19
/**
20
- * @param array $body
+ * @param array|object $body
21
*
22
* @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException
23
* @return $this
@@ -71,10 +71,11 @@ protected function getParamWhitelist()
71
*/
72
protected function getMethod()
73
74
- if (isset($this->body['mappings']) === true) {
+ if (is_array($this->body) && isset($this->body['mappings']) === true) {
75
+ return 'POST';
76
+ } elseif (is_object($this->body) && isset($this->body->mappings) === true) {
77
return 'POST';
- } else {
- return 'PUT';
78
}
79
+ return 'PUT';
80
81
0 commit comments