Generate elasticsearch index template from golang source code
$ go get github.com/fidelitywires/elit
type Human struct {
Name string
Age int
}
t := elit.Template{
Template: "sample_template_*",
Settings: elit.Settings{
NumberOfShards: 5,
NumberOfReplicas: 1,
},
}
p, err := elit.Generate(Human{}, nil)
t.Mappings["sample"] = elit.Type{
Properties: p,
}
This is sample so see also ExampleGenerate function.