IT代码民工 2017-03-03 15:10 采纳率: 25%
浏览 5592
已采纳

elasticsearch导入template问题

最近我正在学习ELK,但我向elasticsearch中导入模板时出错,错误输出如下

{"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: template is missing;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: template is missing;"},"status":400}
我使用的导入模板命令是

 curl -XPUT "http://localhost:9200/_template/wifi" -d@wifi1.json

模板内容为

 {

    "wifi": {
        "order": 0,
        "template": "wifi-*",
        "settings": {
            "index": {
                "refresh_interval": "5s"
            }
        },
        "mappings": {
            "_default_": {
                "dynamic_templates": [
                    {
                        "message_field": {
                            "mapping": {
                                "fielddata": {
                                    "format": "disabled"
                                },
                                "index": "analyzed",
                                "omit_norms": true,
                                "type": "string"
                            },
                            "match_mapping_type": "string",
                            "match": "message"
                        }
                    }
                    ,
                    {
                        "string_fields": {
                            "mapping": {
                                "fielddata": {
                                    "format": "disabled"
                                },
                                "index": "analyzed",
                                "omit_norms": true,
                                "type": "string",
                                "fields": {
                                    "raw": {
                                        "ignore_above": 256,
                                        "index": "not_analyzed",
                                        "type": "string"
                                    }
                                }
                            },
                            "match_mapping_type": "string",
                            "match": "*"
                        }
                    }
                ],
                "_all": {
                    "omit_norms": true,
                    "enabled": true
                },
                "properties": {
                    "@timestamp": {
                        "type": "date"
                    },
            "lat":{
                "type":"float"
                },
            "lon":{
                "type":"float"
                },
                    "geoip": {
                        "dynamic": true,
                        "properties": {
                            "ip": {
                                "type": "ip"
                            },
                            "latitude": {
                                "type": "float"
                            },
                            "location": {
                                "type": "geo_point"
                            },
                            "longitude": {
                                "type": "float"
                            }
                        }
                    },
            "data":{
                "dynamic":true,
                "properties":{
                    "range":{
                    "type":"float"  
                        }
                    }
                },
                    "@version": {
                        "index": "not_analyzed",
                        "type": "string"
                    }
                }
            }
        },
        "aliases": { }
    }
}

另外我使用的elasticsearch版本为2.4.1
希望走过路过的大神,兄台能帮小生解决一下这个问题,在下不胜感激

  • 写回答

2条回答 默认 最新

查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办