必须安装指定版本的插件,不然会报错
ik github地址
[admin@k8s-harbor elasticsearch-5.6.1]$ ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.6.1/elasticsearch-analysis-ik-5.6.1.zip
-> Downloading https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.6.1/elasticsearch-analysis-ik-5.6.1.zip
[=================================================] 100%
-> Installed analysis-ik
pinyin github地址
wget https://github.com/medcl/elasticsearch-analysis-pinyin/releases/download/v5.6.1/elasticsearch-analysis-pinyin-5.6.1.zip
ps aux|grep elasticsearch |grep -v grep | cut -c 9-15 | xargs kill
./bin/elasticsearch -d
{
"settings": {
"index": {
"number_of_shards": "5",
"analysis": {
"filter": {
"my_stopwords": {
"type": "stop",
"stopwords_path": "stopwords.txt"
}
},
"analyzer": {
"pinyin_first_letter": {
"type": "custom",
"tokenizer": "pinyin_first_letter"
},
"smart_analyzer": {
"type": "custom",
"char_filter": ["html_strip"],
"tokenizer": "ik_smart"
},
"my_analyzer": {
"type": "custom",
"char_filter": ["html_strip"],
"tokenizer": "ik_max_word"
},
"pinyin_analyzer": {
"type": "custom",
"tokenizer": "my_pinyin"
}
},
"tokenizer": {
"pinyin_first_letter": {
"lowercase": "true",
"keep_original": "false",
"keep_first_letter": "true",
"keep_separate_first_letter": "false",
"type": "pinyin",
"limit_first_letter_length": "50",
"keep_full_pinyin": "false"
},
"my_pinyin": {
"lowercase": "true",
"keep_original": "false",
"remove_duplicated_term": "false",
"keep_separate_first_letter": "false",
"type": "pinyin",
"limit_first_letter_length": "16",
"keep_full_pinyin": "true"
}
}
},
"number_of_replicas": "1"
}
},
"mappings": {
"department": {
"properties": {
"innerId": {
"type": "keyword"
},
"name": {
"analyzer": "my_analyzer",
"type": "text",
"fields": {
"pinyin_first_letter": {
"analyzer": "pinyin_first_letter",
"type": "text"
},
"ik": {
"analyzer": "my_analyzer",
"type": "text"
},
"pinyin": {
"analyzer": "pinyin_analyzer",
"type": "text"
},
"text": {
"type": "keyword"
}
}
},
"topCourtId": {
"type": "keyword"
},
"id": {
"type": "keyword"
},
"isActive": {
"type": "boolean"
},
"type": {
"type": "integer"
},
"courtId": {
"type": "keyword"
}
}
}
}
}