Ensure index exists

@param string $index
515970
protected function createInClient($index)
    {
        $param = $this->load($index);

        if (!$param) {
            throw new \InvalidArgumentException(sprintf("'%s' index definition does not exist", $index));
        }

        $namespace      = $this->client->indices();
        $indexRealname  = $this->getIndexRealname($index);

        if (!$namespace->exists(['index' => $indexRealname])) {
            $namespace->create([
                'index' => $indexRealname,
                'body'  => $param,
            ]);
        }
    }
1289836
public function index_exists(xmldb_table $xmldb_table, xmldb_index $xmldb_index) {
        if (!$this->table_exists($xmldb_table)) {
            return false;
        }
        return ($this->find_index_name($xmldb_table, $xmldb_index) !== false);
    }
527042
public function offsetExists( $index ) {
		if ( $this->deepSelectorOption ) {
			return \UArray::hasDeepSelector( $this->getArrayCopy( ), $index );
		}
		return parent::offsetExists( $index );
	}
794044
public function setActionIndex(int $index = null) : self
    {
        if ($index) {
            return $this->addAttribute('data-action-index', (string) $index);
        } else {
            return $this->removeAttribute('data-index-action');
        }
    }
137398
private function addUsedIndex(string $index)
    {
        // add user index and detect default translate (default: index == translate)
        $this->listUsedIndex[$index] = (isset($this->dictionary[$index]) && $this->dictionary[$index] != $index);
    }
164084
private function removeExisting(Lucene\Index $index, $hash)
    {
        try {
            $hits = $index->find(self::HASH_FIELDNAME . ':' . $hash);
            foreach ($hits as $hit) {
                $index->delete($hit->id);
            }
        } catch (\Exception $ex) {
            // FIXME no result ???
        }
    }
978105
protected function correctIndexOffset($index)
    {
        return mb_strlen(mb_substr($this->title, 0, $index, $this->encoding), $this->encoding);
    }
54165
public function addIndex($type, $index)
    {
        if (!isset($this->indexes[$type])) {
            $this->indexes[$type] = [];
        }

        $this->indexes[$type][] = $index;
    }
846720
public function isFocused( $index = NULL ){
		if( !count( $this->focusedIndices ) )
			return FALSE;
		if( $index && !array_key_exists( $index, $this->focusedIndices ) )
			return FALSE;
		return TRUE;
	}
868408
public function setIndex($index): self
    {
        if ($index instanceof Index) {
            $index = $index->getName();
        }
        $this->_metadata['_index'] = $index;

        return $this;
    }
1093329
public static function isRegistered($index)
    {
        if (self::$_registry === null) {
            return false;
        }
        return self::$_registry->offsetExists($index);
    }
395072
final protected function setIndex($index)
    {
        $this->model->leafIndex = $index;
        $this->model->updatePath();
        // Signal to all or any sub leaves that need to recompute their own path now.
        $this->leafPathChanged();
    }
742212
public static function isset(string $index):bool
    {
        return (isset(self::$framework_paths[$index])? true : false);
    }
342447
public function indexExists(IndexEvent $event)
    {
        $exists = $this->getClient()->indices()->exists(array(
            "index" => $event->getIndexName(),
        ));

        if (false === $exists) {
            throw new IndexNotFoundException(sprintf("The index type '%s' doesn't exist", $event->getIndexName()));
        }
    }
1242007
public function has($name, $index = 0)
    {
        $lowerName = strtolower($name);

        if (!array_key_exists($lowerName, $this->headers)) {
            return false;
        }

        if (func_num_args() < 2) {
            // index was not specified, so we only need to check that there is at least one header value set
            return (bool) count($this->headers[$lowerName]);
        }

        return array_key_exists($index, $this->headers[$lowerName]);
    }
228280
protected function prepareIndex($index)
    {
        foreach ($index as &$value) {
            // Convert ascending
            $value = $value === 'asc' ? 1 : $value;

            // Convert descending
            $value = $value === 'desc' ? -1 : $value;

            // Convert geo to 2d
            $value = $value === 'geo' ? '2d' : $value;
        }

        return $index;
    }
347664
public function offsetExists($index)
    {
        $index = (int)$index;

        if ($index >= 0) return ($this->getLength() > $index);

        return ($this->getLength() >= abs($index));
    }