code: def analyzer(self, *args, **kwargs):
          
          analyzer = analysis.analyzer(*args, **kwargs)
          d = analyzer.get_analysis_definition()
          # empty custom analyzer, probably already defined out of our control
          if not d:
              return
  
          # merge the definition
          merge(self._analysis, d, True)
docs: Explicitly add an analyzer to an index. Note that all custom analyzers
          defined in mappings will also be created. This is useful for search analyzers.
  
          Example::
  
              from elasticsearch_dsl import analyzer, tokenizer
  
              my_analyzer = analyzer('my_analyzer',
                  tokenizer=tokenizer('trigram', 'nGram', min_gram=3, max_gram=3),
                  filter=['lowercase']
              )
  
              i = Index('blog')
              i.analyzer(my_analyzer)