Skip to content

Commit

Permalink
Adjust Get endpoint to properly set create flag
Browse files Browse the repository at this point in the history
op_type must be used when an id is not provided
  • Loading branch information
polyfractal committed Jul 23, 2013
1 parent 532770e commit 3dbc951
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Elasticsearch/Endpoints/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected function getURI()
}

if ($this->createIfAbsent === true) {
$uri .= '/_create';
$uri .= $this->addCreateFlag($uri);
}

return $uri;
Expand Down Expand Up @@ -132,4 +132,15 @@ protected function getBody()
return $this->body;
}
}

private function addCreateFlag()
{
if (isset($this->id) === true) {
return '/_create';
} else {
$this->params['op_type'] = 'create';
return "";
}

}
}

0 comments on commit 3dbc951

Please sign in to comment.