Update API implementation

This commit is contained in:
Marin Bek 2014-11-12 17:34:58 +01:00
parent 8c049cb79c
commit 76ad99bb81

17
goes.go
View File

@ -381,7 +381,7 @@ func (r *Request) Url() string {
}
// XXX : for indexing documents using the normal (non bulk) API
if len(r.api) == 0 && len(r.id) > 0 {
if len(r.id) > 0 {
path += "/" + r.id
}
@ -455,3 +455,18 @@ func (c *Connection) IndicesExist(indexes ...string) (bool, error) {
return resp.Status == 200, err
}
func (c *Connection) Update(d Document, query map[string]interface{}, extraArgs url.Values) (Response, error) {
r := Request{
Conn: c,
Query: query,
IndexList: []string{d.Index.(string)},
TypeList: []string{d.Type},
ExtraArgs: extraArgs,
method: "POST",
api: "_update",
id: d.Id.(string),
}
return r.Run()
}