Z
Z
zdravnik2017-02-08 11:06:16
elasticsearch
zdravnik, 2017-02-08 11:06:16

How to load index template in elasticsearch?

good afternoon.
The logstash config has the following input and output:

input{
redis {
host => "xxxx"
port => 21345
data_type => "list"
key => "test"
threads => 16
type => "223ab-xyz"
}
}
output {
elasticsearch {
hosts => "example. com:80"
index => "223ab-xyz-%{+YYYY.MM}"
template => "/opt/logstash/custom_patterns/elasticsearch-template_223.json"
template_name => "223"
user =>"elastic"
password => "changeme"
}
}

Here is the content of /opt/logstash/custom_patterns/elasticsearch-template_223.json:
{
"template" : "223ab-*",
"settings" : {
"index": {
"refresh_interval": "-1",
"number_of_shards": "4",
"number_of_replicas": "0",
"translog": {
"flush_threshold_size": "512mb"
}
}
},
"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" : "analyzed", "omit_norms" : true,
"fielddata" : { "format" : "disabled" },
"fields" : {
"raw" : {"type": "string", "index " : "not_analyzed", "ignore_above" :256}
}
}
}
} ],
"properties" : {
"@timestamp": { "type": "date" },
"@version": { "type": "string", "index": "not_analyzed" },
"geoip" : {
"dynamic": true,
"properties" : {
"ip": { "type": "ip " },
"location" : { "type" : "geo_point" },
"latitude" : { "type" : "float" },
"longitude" : { "type" : "float" }
}
}
}
}
}
}

Actually, the template from the file is loaded into the elastic without any problems, judging by the logstash logs. Curl to elastic GET _template, the template is also visible. But when data enters the radish and goes through the logstash config, the same new index appears in the elastic, for some reason it has default settings (judging by the GET ' localhost:9200/_all/_settings?pretty ' request), i.e. The template I uploaded does not work.
Tell me what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question