0

我是 ELK 的新手,任何人都可以帮助我。我可以通过在 Kibana 的开发工具中放置以下内容来获得查询结果。但我需要动态加载这个模板,而不是从开发工具中查询。

PUT /my_index
{
    "mappings": {
        "type1" : {
            "properties" : {
                "obj1" : {
                    "type" : "nested"
                }
            }
        }
    }
}

谁能帮我配置这个。提前致谢!

4

1 回答 1

0

如果要在创建索引时设置映射,则需要使用索引模板。您可以使用 ES 开发工具进行设置,使其按名称匹配。例如:

PUT _template/my_index
{
  "template": "my_index*",
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "type1" : {
        "properties" : {
            "obj1" : {
                "type" : "nested"
            }
        }
    }
  }
}

这对于基于时间的索引尤其需要。

如果您只是在寻找工具,请使用 curl:

curl -XPUT http://your_cluster:9200/index -d '{your json here}'

如果需要,您可以以相同的方式编写模板插入脚本

于 2017-03-31T14:32:06.587 回答