Update API implementation
This commit is contained in:
parent
8c049cb79c
commit
76ad99bb81
17
goes.go
17
goes.go
@ -381,7 +381,7 @@ func (r *Request) Url() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// XXX : for indexing documents using the normal (non bulk) API
|
// 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
|
path += "/" + r.id
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,3 +455,18 @@ func (c *Connection) IndicesExist(indexes ...string) (bool, error) {
|
|||||||
|
|
||||||
return resp.Status == 200, err
|
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()
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user