linux centos7 elasticsearch安装拼音

Posted 自行车在路上

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux centos7 elasticsearch安装拼音相关的知识,希望对你有一定的参考价值。

环境配置

PUT pinyin_test

              "settings": 
                "number_of_shards": "3",
                "number_of_replicas": "1",
                "index": 
                  "max_result_window": 2147483647
                ,
                "analysis": 
                  "tokenizer": 
                    "ik_pinyin": 
                      "type": "pinyin",
                      "keep_first_letter": true,
                      "keep_full_pinyin": false,
                      "keep_joined_full_pinyin": true,
                      "keep_original": true,
                      "limit_first_letter_length": 10,
                      "keep_none_chinese": true,
                      "keep_none_chinese_together": true,
                      "none_chinese_pinyin_tokenize": false,
                      "keep_none_chinese_in_first_letter": false,
                      "lowercase": true,
                      "trim_whitespace": false,
                      "remove_duplicated_term": true,
                      "keep_separate_first_letter": false
                    
                  ,
                  "analyzer": 
                    "custom_ik_max_word": 
                      "filter": [
                        "lowercase",
                        "asciifolding"
                      ],
                      "char_filter": [
                        "html_strip"
                      ],
                      "type": "custom",
                      "tokenizer": "ik_max_word"
                    ,
                    "custom_ik_smart": 
                      "filter": [
                        "lowercase",
                        "asciifolding"
                      ],
                      "char_filter": [
                        "html_strip"
                      ],
                      "type": "custom",
                      "tokenizer": "ik_smart"
                    ,
                    "pinyin_analyzer": 
                      "tokenizer": "ik_pinyin"
                    
                  
                
              ,
               "mappings": 
                  "properties": 
                  "publish_time": 
                          "type": "date",
                          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
                        
                    
               

当执行的时候,报错


  "error" : 
    "root_cause" : [
      
        "type" : "illegal_argument_exception",
        "reason" : "Unknown tokenizer type [pinyin] for [ik_pinyin]"
      
    ],
    "type" : "illegal_argument_exception",
    "reason" : "Unknown tokenizer type [pinyin] for [ik_pinyin]"
  ,
  "status" : 400


开始安装pinyin
下载

https://github.com/medcl/elasticsearch-analysis-pinyin/releases

找到对应的版本,跟es一致
然后解压到es目录的plugins里的pinyin文件夹(没有自己创建)

如果报这个错,请参考
Elasticsearch整合ik分词


  "acknowledged" : true,
  "shards_acknowledged" : true,
  "index" : "pinyin_test"


成功了

以上是关于linux centos7 elasticsearch安装拼音的主要内容,如果未能解决你的问题,请参考以下文章

Elasticsearch7.10.0集群搭建

Elasticsearch7.10.0集群搭建

elasticsear+kibana+logstash 优化

Spring Cloud 分布式链路跟踪 Sleuth + Zipkin + Elasticsear

Spring Cloud 分布式链路跟踪 Sleuth + Zipkin + Elasticsear

Elasticsearch7.7.0安装