Skip to content

Commit

Permalink
/Indices/Warmer/Get should throw exception on bad argument combination
Browse files Browse the repository at this point in the history
If `index` and `type` are specified but not `name`, an exception
should be thrown sinc this is an illegal combination.  Valid
combinations are:

"/_warmer", "/{index}/_warmer", "/{index}/_warmer/{name}", "/_warmer/{name}", "/{index}/{type}/_warmer/{name}"
  • Loading branch information
polyfractal committed Jan 24, 2014
1 parent e60bca2 commit c053208
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Elasticsearch/Endpoints/Indices/Warmer/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function setName($name)


/**
* @throws \Elasticsearch\Common\Exceptions\RuntimeException
* @return string
*/
protected function getURI()
Expand All @@ -56,6 +57,8 @@ protected function getURI()
$uri = "/$index/$type/_warmer/$name";
} elseif (isset($index) === true && isset($name) === true) {
$uri = "/$index/_warmer/$name";
} elseif (isset($index) === true && isset($type) === true) {
throw new Exceptions\RuntimeException('Invalid index/type/name combination. If index + type are defined, name must also be defined');
} elseif (isset($index) === true) {
$uri = "/$index/_warmer";
} elseif (isset($name) === true) {
Expand Down

0 comments on commit c053208

Please sign in to comment.