code: def update(self, index, fields, tokenizer=default_tokenizer, cutoff=1):
          
          counts_by_uid = defaultdict(Counter)
          for word, count in self._gather_words(
                  index, fields, tokenizer=tokenizer).items():
              uid = hashlib.sha1(unicodedata.normalize(
                  "NFKD", word.lower()).encode("UTF-8")).hexdigest()
              counts_by_uid[uid][word] += count
  
          for uid, word_to_count in counts_by_uid.items():
              word = word_to_count.most_common(1)[0][0]
              count = sum(word_to_count.values())
              if count <= cutoff:
                  continue
              self.connection.session.post(
                  "/%s/%s/%s/_update" % (self.target_coll_name,
                                         self.target_type, uid),
                  data={
                      "script": "ctx._source.count += count",
                      "params": {"count": count},
                      "upsert": {"word": word, "count": count}
                  })
docs: Update (upsert) the wordgatherer collection.
          :param index: Source index.
          :param fields: Fields to read.
          :param tokenizer: Tokenizer callable. Should split unicode to words
          :param cutoff: Ignore words with less than this many occurrences.