1、es集羣安裝完畢
2、下載IK
源碼下載:https://github.com/medcl/elasticsearch-analysis-ik
3、解壓到到ES_HOME/plugins/ik目錄下面(直接包含一個conf文件夾和一堆.jar包)
重新啓動ES,啓動 看到try load config ……IK相關信息,說明啓動完成和安裝IK插件完成。
4、測試例子:
在Kibana的Dev Tools中,運行
GET _analyze?pretty
{
"analyzer":"ik_smart",
"text":"中國人民警察的服務宗旨"
}
5、索引模版
PUT _template/logstash-kafka
{
"order" : 6,
"version" : 60001,
"index_patterns" : [
"logstash-kafka*"
],
"settings" : {
"index" : {
"refresh_interval" : "60s",
"number_of_shards" : "3",
"analysis.analyzer.default.type": "ik_max_word",
"translog" : {
"sync_interval" : "60s",
"durability" : "async"
},
"number_of_replicas" : "1"
}
},
"mappings" : {
"dynamic_templates" : [
{
"message_field" : {
"path_match" : "message",
"mapping" : {
"norms" : false,
"type" : "text"
},
"match_mapping_type" : "string"
}
},
{
"string_fields" : {
"mapping" : {
"norms" : false,
"type" : "text",
"fields" : {
"keyword" : {
"ignore_above" : 256,
"type" : "keyword"
}
}
},
"match_mapping_type" : "string",
"match" : "*"
}
}
],
"properties" : {
"@timestamp" : {
"type" : "date"
},
"geoip" : {
"dynamic" : true,
"properties" : {
"ip" : {
"type" : "ip"
},
"latitude" : {
"type" : "half_float"
},
"location" : {
"type" : "geo_point"
},
"longitude" : {
"type" : "half_float"
}
}
},
"@version" : {
"type" : "keyword"
}
}
},
"aliases" : { }
}