【发布时间】:2016-05-03 01:19:24
【问题描述】:
我正在寻找在elasticsearch中创建索引的指南,但它并不像以下给出的指南那么简单:
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html
我想做的事情似乎很简单,但我似乎无法让它发挥作用。现在,我希望我的索引是每日索引(与默认的 logstash 索引相同)但有一些变化。这些更改包括名称更改和具有特定类型的字段的特定映射。现在我知道我必须在 logstasg 配置的 output-elasticsearch 部分中指定:
index => "name-%{+YYYY.MM.dd}"
我发现的唯一信息是可以基于模板创建索引,我尝试创建模板但仍然没有任何反应。
创建模板我使用了以下内容:
PUT _template/ids
{
"template": "ids-*",
"order": 0,
"settings": {
"index": {
"number_of_shards": 5,
"number_of_replicas": 1
},
"mappings": {
"log": {
"_all": {
"enabled": true,
"omit_norms": true
},
"properties": {
"@timestamp": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"@version": {
"type": "string",
"index": "not_analyzed"
},
"field1": {
"type": "string",
"index": "not_analyzed"
},
"field2": {
"type": "string",
"index": "not_analyzed"
},
【问题讨论】:
-
您能否提供更多信息,例如用于
index-creation和template-creation的命令? -
对于
template-creation,我使用了以下命令,其中包含一些设置:PUT _template/ids { "template": "ids-*", "order": 0, "settings": { "index": { "number_of_shards": 5, "number_of_replicas": 1 }, "mappings": {...。如果我运行这个命令,我会得到它被接受的结果,但前进是我卡住的地方。 -
由于某种原因,我看不到您的完整命令。你能用完整的命令更新你的问题吗?但是,如果您成功创建模板,则可以通过使用模式
ids-*创建测试索引来测试它,例如ids-test。 -
我更新了问题。我也尝试了我们的建议,它创建了类似
ids-test的东西。但是我将如何更改它以便它每天创建该索引? -
ids-testindex 是否获得了 index-pattern 中提供的所有设置和映射?
标签: elasticsearch indexing logstash