使用 man ascii 来查看 ASCII 表。

如何在 在创建索引时 指定 token filter 有指定自定义分词插件中的token filter么??

Elasticsearch | 作者 liyi | 发布于2017年06月21日 | 阅读数:3543

写了分词插件,里面开放了 token filter

@Override public Map<String, AnalysisModule.AnalysisProvider<TokenFilterFactory>> getTokenFilters(){ Map<String, AnalysisModule.AnalysisProvider<TokenFilterFactory>> extra = new HashMap<>(); extra.put("ngram_search_number_tokenFilter", FactminrTokenFilterFactory::getSearchNumberTokenFilterFactory); extra.put("ngram_merge_number_tokenFilter", FactminrTokenFilterFactory::getMergeNumberTokenFilterFactory); return extra; }
 
但是在客户端创建索引时,指定,无法创建索引
 "analysis": {
      "analyzer": {
        "ngram_merge_number_test": {
          "tokenizer": "ngram_ch_tokenizer",
          "filter": [
            "ngram_merge_number_tokenFilter"
          ],
          "char_filter": [
            "ngram_stop",
            "ngram_ignore"
          ],
          "type": "custom"
        }
      },
 
 
报错信息:
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Custom Analyzer [ngram_merge_number_test] failed to find filter under name [ngram_merge_number_tokenFilter]"}],"type":"illegal_argument_exception","reason":"Custom Analyzer [ngram_merge_number_test] failed to find filter under name [ngram_merge_number_tokenFilter]"},"status":400}
 
 
已邀请:

medcl - 今晚打老虎。

赞同来自:

仔细研究下插件那块,注册应该是没有成功。

要回复问题请先登录注册