commit
a3660786e2
3
goes.go
3
goes.go
@ -165,7 +165,7 @@ func (c *Connection) BulkSend(index string, documents []Document) (Response, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search executes a search query against an index
|
// 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{
|
r := Request{
|
||||||
Conn: c,
|
Conn: c,
|
||||||
Query: query,
|
Query: query,
|
||||||
@ -173,6 +173,7 @@ func (c *Connection) Search(query map[string]interface{}, indexList []string, ty
|
|||||||
TypeList: typeList,
|
TypeList: typeList,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
api: "_search",
|
api: "_search",
|
||||||
|
ExtraArgs: extraArgs,
|
||||||
}
|
}
|
||||||
|
|
||||||
return r.Run()
|
return r.Run()
|
||||||
|
@ -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)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
var expectedTotal uint64 = 2
|
var expectedTotal uint64 = 2
|
||||||
@ -275,7 +275,7 @@ func (s *GoesTestSuite) TestBulkSend(c *C) {
|
|||||||
_, err = conn.RefreshIndex(indexName)
|
_, err = conn.RefreshIndex(indexName)
|
||||||
c.Assert(err, IsNil)
|
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)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
expectedTotal = 0
|
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{
|
expectedHits := Hits{
|
||||||
Total: 1,
|
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"]
|
user, ok := resp.Aggregations["user"]
|
||||||
c.Assert(ok, Equals, true)
|
c.Assert(ok, Equals, true)
|
||||||
|
Loading…
Reference in New Issue
Block a user