yii\elasticsearch\Command::updateAnalyzers PHP Method

updateAnalyzers() public method

For example if content analyzer hasn’t been defined on "myindex" yet you can use the following commands to add it: ~~~ $setting = [ 'analysis' => [ 'analyzer' => [ 'ngram_analyzer_with_filter' => [ 'tokenizer' => 'ngram_tokenizer', 'filter' => 'lowercase, snowball' ], ], 'tokenizer' => [ 'ngram_tokenizer' => [ 'type' => 'nGram', 'min_gram' => 3, 'max_gram' => 10, 'token_chars' => ['letter', 'digit', 'whitespace', 'punctuation', 'symbol'] ], ], ] ]; $elasticQuery->createCommand()->updateAnalyzers('myindex', $setting); ~~~
See also: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html#update-settings-analysis
Since: 2.0.4
public updateAnalyzers ( string $index, string | array $setting, array $options = [] ) : mixed
$index string
$setting string | array
$options array URL options
return mixed
    public function updateAnalyzers($index, $setting, $options = [])
    {
        $this->closeIndex($index);
        $result = $this->updateSettings($index, $setting, $options);
        $this->openIndex($index);
        return $result;
    }