我希望我的字符串是not_analyzed的搜索和可视化在Kibana。
我创建了一个自定义的elasticsearch-template.json,将字符串的默认值设置为not_analyzed,并在我的logstash-log4j.conf文件中指出了这一点。以下是elasticsearch-template.json:
{
"template" : "logstash-*",
"settings" : {
"index.refresh_interval" : "5s"
},
"mappings" : {
"_default_" : {
"_all" : {"enabled" : true, "omit_norms" : true},
"dynamic_templates" : [ {
"message_field" : {
"match" : "message",
"match_mapping_type" : "string",
"mapping" : {
"type" : "string", "index" : "analyzed", "omit_norms" : true
}
}
}, {
"string_fields" : {
"match" : "*",
"match_mapping_type" : "string",
"mapping" : {
"type" : "string", "index" : "not_analyzed", "omit_norms" : true,
}
}
} ],
"properties" : {
"@version": { "type": "string", "index": "not_analyzed" },
"geoip" : {
"type" : "object",
"dynamic": true,
"properties" : {
"location" : { "type" : "geo_point" }
}
}
}
}
}
}我将此文件与logstash-log4j.com放在同一个目录中,其中包含:
output {
stdout {
codec => rubydebug
}
elasticsearch {
cluster => 'hlt_logs'
index => 'logstash-symphony'
template => "/elk/logstash/current/elasticsearch-template.json"
}
}在做了以下更改后,我使用curl删除并替换了elasticsearch索引:
curl -XDELETE -i 'http://localhost:9200/logstash-symphony'
curl -XPUT -i 'http://localhost:9200/logstash-symphony'我添加了一些新的日志,并在Kibana中进行了可视化,但我仍然将我的字符串作为分析字段。我遗漏了什么?
发布于 2015-11-06 13:27:03
elasticsearch输出插件的template参数可用于提供您的index template,以供Elasticsearch在创建新Logstash索引时使用。
https://stackoverflow.com/questions/33439668
复制相似问题