Create an index.

@param array $index   string fieldname or multi-key-index array
@param array $options index options

@return object $this
187744
public function create(array $index, $options = [])
    {
        // Convert expressive syntax
        $index = $this->prepareIndex($index);

        // Ensure the index
        $this->collection->ensureIndex($index, $options);

        return $this;
    }
766501
protected function createZedClient($index = null): Index
    {

        if ($index === null) {
            $index = Config::get(ConditionalAvailabilityConstants::ELASTICA_PARAMETER__INDEX_NAME);
        }

        return parent::createZedClient($index);
    }
1258219
public function addOptions(array $options)
    {
        foreach ($options as $name => $value) {
            $this->setOption($name, $value);
        }

        return $this;
    }
533806
function setArray(array $options) {
        foreach ($options as $key => $value) {
            $this->set($key, $value);
        }
        return $this;
    }
990940
public static function create(array $options): Token
    {
        $token = new self($options);
        $token->token = $token->generate();

        return $token;
    }
1140649
public function addIndex($index)
    {
        if ($index instanceof Index) {
            if ($this->hasIndex($index->getName())) {
                throw new InvalidArgumentException(sprintf('Index "%s" already exist.', $index->getName()));
            }
            if (!$index->getColumns()) {
                throw new InvalidArgumentException(sprintf('Index "%s" has no columns.', $index->getName()));
            }
            $index->setTable($this);
            // force the name to be created if empty.
            $this->indices[] = $index;

            return $index;
        }

        $idx = new Index();
        $idx->loadMapping($index);
        foreach((array)@$index['columns'] as $column) {
            $idx->addColumn($column);
        }

        return $this->addIndex($idx);
    }
490784
public function setOptions(array $options)
    {
        $this->validateOptions($options, $this->type);

        $this->options = $options;

        return $this;
    }
270429
protected function populateIndex($index)
    {
        $this->line('Populating the index « '.$index.' » ...');

        // Replaces the current default index by the one we want to populate
        $defaultIndex = Plastic::getDefaultIndex();
        Plastic::setDefaultIndex($index);

        // Disables query logging to prevent memory leak
        $logging = DB::connection()->logging();
        DB::connection()->disableQueryLog();

        // Populates from models
        $models = $this->models($index);
        $chunkSize = $this->chunkSize();
        foreach ($models as $model) {
            $this->line('Indexing documents of model « '.$model.' » ...');
            $model::chunk($chunkSize, function ($items) {
                $this->line('Indexing chunk of '.$items->count().' documents ...');
                Plastic::persist()->bulkSave($items);
            });
        }

        // Restores query logging
        if ($logging) {
            DB::connection()->enableQueryLog();
        }

        // Restores the current default index
        Plastic::setDefaultIndex($defaultIndex);
    }
693497
public function fromArray($options)
    {
        if (isset($options['Index'])) {
            Validate::isInteger($options['Index'], 'options[Index]');
            $this->_index = (int) $options['Index'];
        }
    }
1168720
public function setOptions($options = [])
    {
        if (!is_array($options)) {
            $options = [];
        }

        $this->options = array_merge($this->getDefaults(), $options);
        return $this;
    }
401851
public function createIndex($collection, $columns, array $options = [])
    {
        $col = $this->db->selectCollection($collection);

        return $col->createIndex($columns, $options);
    }
195883
public function createPrimaryIndex($bucketName, $indexName = null, $options = [])
    {
        $bucketName = $this->db->quoteBucketName($bucketName);

        if ($indexName) {
            $indexName  = $this->db->quoteBucketName($indexName);
        }

        $sql = "CREATE PRIMARY INDEX $indexName ON $bucketName";

        if (!empty($options)) {
            $sql .= ' WITH ' . Json::encode($options, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT);
        }

        return $sql;
    }
1303107
public function setOptions(array $options)
    {
        foreach ($options as $name => $value) {
            $method = 'set' . ucfirst($name);

            if (method_exists($this, $method)) {
                $this->$method($value);
            } else {
                $this->options[$name] = $value;
            }
        }

        return $this;
    }
242796
public function select($index) {
    $this->init();
    
    $this->select = $index;
    $this->html->getTemplateContent()->select =
      jsHelper::embed(
        jsHelper::bootLoad(
          array('app/main'),
          array('main'),
          sprintf("var tabs = main.getTabs(), tab = tabs.tab({index: %d});\n    tabs.select(tab);", $this->select)
        )
      )
    ;
    return $this;
  }
705950
public function createPrimaryIndex($indexName = null, $options = [])
    {
        return $this->db->createPrimaryIndex($this->name, $indexName, $options);
    }
831511
public function createIndex(Index $index, $table)
    {
        $this->_execSql($this->_platform->getCreateIndexSQL($index, $table));
    }
520528
public function setOptions(array $options)
    {
        foreach ($options as $k => $v) {
            $this->_options[$k] = $v;
        }
        return $this;
    }