@zdravnik

Как загрузить шаблон индекса в elasticsearch?

добрый день.

В конфиге логсташа есть следующий инпут и аутпут:
input{
redis {
host => "x.x.x.x"
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"
}
}


Вот содержимое /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" }
}
}
}
}
}
}


Собственно шаблон из файла загружается в эластик без проблем судя по логам логсташа. Делая курл в эластик GET _template, шаблон тоже виден. Но когда в редис поступают данные и проходят через конфиг логсташа то в эластике появялется тот самый новый индекс, он почему-то имеет дефолтные настройки (судя по запросу GET 'localhost:9200/_all/_settings?pretty'), т.е. загруженный мною шаблон не отрабатывает.
Подскажите что я делаю не так?
  • Вопрос задан
  • 1261 просмотр
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы