elasticsearch\Command updateAnalyzers()

updateAnalyzers() public method (available since version 2.0.4)

Define new analyzers for the index.

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.

public mixed updateAnalyzers ( $index, $setting, $options = [] )
$index string
$setting string|array
$options array

URL options

doc_Yii
2016-10-30 17:01:42
Comments
Leave a Comment

Please login to continue.