{
"test":{
"template":"test",
"settings":{
"index.number_of_shards":5,
"number_of_replicas":1,
"index":{
"store":{
"compress":{
"stored":true,
"tv":true
}
}
}
},
"mappings":{
"_default_":{
"properties":{
"dynamic":"true"
}
},
"loadbalancer":{
"properties":{
"@fields":{
"dynamic":"true",
"properties":{
"logtime":{
"type":"string",
"index":"not_analyzed"
},
"ip":{
"type":"string",
"index":"not_analyzed"
},
"downloadtype":{
"type":"integer",
"index":"not_analyzed"
},
"browser":{
"type":"string",
"index":"not_analyzed"
}
}
},
"@source":{
"type":"string",
"index":"not_analyzed"
},
"@timestamp":{
"type":"date",
"format":"dateOptionalTime"
},
"@type":{
"type":"string",
"index":"not_analyzed",
"store":"no"
}
}
}
}
}
}
报错 org.elasticsearch.action.ActionRequestValidationException: Validation Failed: 1: template is missing
去掉最外层的test 改为
{
"template":"test",
"settings":{
"index.number_of_shards":5,
"number_of_replicas":1,
"index":{
"store":{
"compress":{
"stored":true,
"tv":true
}
}
}
},
"mappings":{
"_default_":{
"properties":{
"dynamic":"true"
}
},
"loadbalancer":{
"properties":{
"@fields":{
"dynamic":"true",
"properties":{
"logtime":{
"type":"string",
"index":"not_analyzed"
},
"ip":{
"type":"string",
"index":"not_analyzed"
},
"downloadtype":{
"type":"integer",
"index":"not_analyzed"
},
"browser":{
"type":"string",
"index":"not_analyzed"
}
}
},
"@source":{
"type":"string",
"index":"not_analyzed"
},
"@timestamp":{
"type":"date",
"format":"dateOptionalTime"
},
"@type":{
"type":"string",
"index":"not_analyzed",
"store":"no"
}
}
}
}
}