From d48efef61023f7ad4cb07c9435a0e30d044b705d Mon Sep 17 00:00:00 2001 From: r--w Date: Wed, 7 May 2014 14:49:13 +0200 Subject: [PATCH 1/2] Added extrargs for searching Extra args to allow routing parameter --- goes.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/goes.go b/goes.go index 245c3e9..8e8907e 100644 --- a/goes.go +++ b/goes.go @@ -165,7 +165,7 @@ func (c *Connection) BulkSend(index string, documents []Document) (Response, err } // Search executes a search query against an index -func (c *Connection) Search(query map[string]interface{}, indexList []string, typeList []string) (Response, error) { +func (c *Connection) Search(query map[string]interface{}, indexList []string, typeList []string, extraArgs url.Values) (Response, error) { r := Request{ Conn: c, Query: query, @@ -173,6 +173,7 @@ func (c *Connection) Search(query map[string]interface{}, indexList []string, ty TypeList: typeList, method: "POST", api: "_search", + ExtraArgs: extraArgs, } return r.Run() From e9c3e322c86e2ad5b96d48ad8759453b57cb5d7b Mon Sep 17 00:00:00 2001 From: r--w Date: Wed, 7 May 2014 14:57:37 +0200 Subject: [PATCH 2/2] Extra args for searching --- goes_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/goes_test.go b/goes_test.go index 455c679..cf2bb81 100644 --- a/goes_test.go +++ b/goes_test.go @@ -224,7 +224,7 @@ func (s *GoesTestSuite) TestBulkSend(c *C) { }, } - searchResults, err := conn.Search(query, []string{indexName}, []string{}) + searchResults, err := conn.Search(query, []string{indexName}, []string{}, url.Values{}) c.Assert(err, IsNil) var expectedTotal uint64 = 2 @@ -275,7 +275,7 @@ func (s *GoesTestSuite) TestBulkSend(c *C) { _, err = conn.RefreshIndex(indexName) c.Assert(err, IsNil) - searchResults, err = conn.Search(query, []string{indexName}, []string{}) + searchResults, err = conn.Search(query, []string{indexName}, []string{}, url.Values{}) c.Assert(err, IsNil) expectedTotal = 0 @@ -525,7 +525,7 @@ func (s *GoesTestSuite) TestSearch(c *C) { }, }, } - response, err := conn.Search(query, []string{indexName}, []string{docType}) + response, err := conn.Search(query, []string{indexName}, []string{docType}, url.Values{}) expectedHits := Hits{ Total: 1, @@ -793,7 +793,7 @@ func (s *GoesTestSuite) TestAggregations(c *C) { }, } - resp, err := conn.Search(query, []string{indexName}, []string{docType}) + resp, err := conn.Search(query, []string{indexName}, []string{docType}, url.Values{}) user, ok := resp.Aggregations["user"] c.Assert(ok, Equals, true)