I have a full configuration running (logstash/elastic search/kibana)
As I would like to set dynamic fields as not_analyzed, I created a template on logstash side (with a name matching the index name used in elastic search output section of logstash)
As for now, the fields are still analyzed.
I am a little bit puzzled by the template management, do I need to upload it also on the elastic search side ?
{
"template" : ""elk-xyz-logs-*",
"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,
"fielddata" : { "format" : "disabled" }
}
}
}, {
"string_fields" : {
"match" : "*",
"match_mapping_type" : "string",
"mapping" : {
"type" : "string", "index" : "not_analyzed", "omit_norms" : true
}
}
}, {
output {
file {
path => "/var/log/logstash/output.log"
}
elasticsearch {
index => "elk-xyz-logs-%{+YYYY.MM.dd}"
template => "/etc/logstash/templates/elk-xyz-logstash.json"
template_overwrite => true
manage_template => false
}
}
Side note:
My first attempt was to create my template file in conf.d directory => that is a bad idea as it looks like all the files in this directory are merged when logstash starts...