Elastica\Client::getStatus PHP Method

getStatus() public method

Returns the status object for all indices.
public getStatus ( ) : Status
return Status Status object
    public function getStatus()
    {
        return new Status($this);
    }

Usage Example

コード例 #1
0
 /**
  * Pick the index identifier from the provided command line option.
  * @param string $option command line option
  *          'now'        => current time
  *          'current'    => if there is just one index for this type then use its identifier
  *          other string => that string back
  * @param string $typeName
  * @return string index identifier to use
  */
 public function pickIndexIdentifierFromOption($option, $typeName)
 {
     if ($option === 'now') {
         $identifier = strval(time());
         $this->outputIndented("Setting index identifier...{$typeName}_{$identifier}\n");
         return $identifier;
     }
     if ($option === 'current') {
         $this->outputIndented('Infering index identifier...');
         $found = array();
         foreach ($this->client->getStatus()->getIndexNames() as $name) {
             if (substr($name, 0, strlen($typeName)) === $typeName) {
                 $found[] = $name;
             }
         }
         if (count($found) > 1) {
             $this->output("error\n");
             $this->error("Looks like the index has more than one identifier. You should delete all\n" . "but the one of them currently active. Here is the list: " . implode($found, ','), 1);
         }
         if ($found) {
             $identifier = substr($found[0], strlen($typeName) + 1);
             if (!$identifier) {
                 // This happens if there is an index named what the alias should be named.
                 // If the script is run with --startOver it should nuke it.
                 $identifier = 'first';
             }
         } else {
             $identifier = 'first';
         }
         $this->output("{$typeName}_{$identifier}\n");
         return $identifier;
     }
     return $option;
 }
All Usage Examples Of Elastica\Client::getStatus