我希望我的字符串在Kibana中用于搜索和可视化not_analyzed
。
我创建了一个自定义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中进行了可视化,但我仍然将我的字符串作为分析字段。我错过了什么?