1.安装pinyin插件和ik插件。
2.先创建type(kibana操作):
PUT article_v2018051101/
{
"index": {
"analysis": {
"analyzer": {
"ik_pinyin_analyzer": {
"type": "custom",
"tokenizer": "ik_smart",
"filter": [
"my_pinyin",
"word_delimiter"
]
}
},
"filter": {
"my_pinyin": {
"lowercase": "true",
"type": "pinyin",
"limit_first_letter_length": "16",
"keep_original": "true",
"keep_full_pinyin": "true",
"keep_none_chinese ":"true",
"keep_first_letter":"true",
"keep_none_chinese_together":"true",
"none_chinese_pinyin_tokenize":"true",
"keep_original ":"true"
}
}
}
}
}
3.创建mapping(article_category_index字段添加了ik和pinyin分词):
POST /article_v5251571/info/_mapping
{
"info": {
"properties": {
"article_activity": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"article_activity_type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"article_add_time": {
"type": "date"
},
"article_brand_first_char": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"article_brand_id": {
"type": "long"
},
&