I'm trying to set mapping in elastic search in go and want to generate 
something like this.

{ "mappings": { "_doc": { "properties": { "title": { "type": "text", "store": 
true }, "date": { "type": "date", "store": true }, "content": { "type": "text" 
} } } } }


The _doc, title,date and content are all keys that will change depending on 
what mapping I am trying to generate. 

I have a basic struct layout but cant work out how to generate the proper 
JSON.

type mappingData struct {
        Mappings struct {
                Doc struct {
                        Properties struct {
                                Elements []Fields
                        } `json:"properties"`
                } `json:"_doc"`
        } `json:"mappings"`
}


type Fields struct {
        Type  string `json:"type"`
        Store bool   `json:"store"`
}

_doc will be from a string and I have a vector of structs that has 
different fields in.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to