Skip to content

Commit

Permalink
Update Index\Status methods to use new API
Browse files Browse the repository at this point in the history
  • Loading branch information
jlinn committed May 30, 2013
1 parent 2dea068 commit ede019c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 4 additions & 0 deletions changes.txt 100644 → 100755
@@ -1,5 +1,9 @@
CHANGES

2013-05-30
- Update Index\Status::getAliases() to use new API
- Update Index\Status::getSettings() to use new API

2013-05-29
- Add _meta to mapping. #330

Expand Down
14 changes: 4 additions & 10 deletions lib/Elastica/Index/Status.php 100644 → 100755
Expand Up @@ -86,11 +86,8 @@ public function get()
*/
public function getAliases()
{
// TODO Update as soon as new API is implemented
$cluster = new Cluster($this->_index->getClient());
$state = $cluster->getState();

return $state['metadata']['indices'][$this->_index->getName()]['aliases'];
$responseData = $this->getIndex()->request('_aliases', \Elastica\Request::GET)->getData();
return array_keys($responseData[$this->getIndex()->getName()]['aliases']);
}

/**
Expand All @@ -100,11 +97,8 @@ public function getAliases()
*/
public function getSettings()
{
// TODO Update as soon as new API is implemented
$cluster = new Cluster($this->_index->getClient());
$state = $cluster->getState();

return $state['metadata']['indices'][$this->_index->getName()]['settings'];
$responseData = $this->getIndex()->request('_settings', \Elastica\Request::GET)->getData();
return $responseData[$this->getIndex()->getName()]['settings'];
}

/**
Expand Down

0 comments on commit ede019c

Please sign in to comment.