From 76ad99bb81a085878d16343a2e2b1fcfec1fda32 Mon Sep 17 00:00:00 2001 From: Marin Bek Date: Wed, 12 Nov 2014 17:34:58 +0100 Subject: [PATCH] Update API implementation --- goes.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/goes.go b/goes.go index b162306..d5dfbab 100644 --- a/goes.go +++ b/goes.go @@ -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() +}