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" : { }
}
(责任编辑:IT) |