Added indexList and extraArgs support to Connection.Stats()
This commit is contained in:
parent
92081c6d25
commit
726e1e80b9
10
goes.go
10
goes.go
@ -69,11 +69,13 @@ func (c *Connection) RefreshIndex(name string) (Response, error) {
|
||||
}
|
||||
|
||||
// Stats fetches statistics (_stats) for the current elasticsearch server
|
||||
func (c *Connection) Stats() (Response, error) {
|
||||
func (c *Connection) Stats(indexList []string, extraArgs url.Values) (Response, error) {
|
||||
r := Request{
|
||||
Conn: c,
|
||||
method: "GET",
|
||||
api: "_stats",
|
||||
Conn: c,
|
||||
IndexList: indexList,
|
||||
ExtraArgs: extraArgs,
|
||||
method: "GET",
|
||||
api: "_stats",
|
||||
}
|
||||
|
||||
return r.Run()
|
||||
|
@ -292,15 +292,16 @@ func (s *GoesTestSuite) TestBulkSend(c *C) {
|
||||
|
||||
func (s *GoesTestSuite) TestStats(c *C) {
|
||||
conn := NewConnection(ES_HOST, ES_PORT)
|
||||
indexName := "testfetchstats"
|
||||
indexName := "teststats"
|
||||
|
||||
conn.DeleteIndex(indexName)
|
||||
_, err := conn.CreateIndex(indexName, map[string]interface{}{})
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
// we must wait for a bit otherwise ES crashes
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
response, err := conn.Stats()
|
||||
response, err := conn.Stats([]string{indexName}, url.Values{})
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
c.Assert(response.All.Indices[indexName].Primaries["docs"].Count, Equals, 0)
|
||||
|
Loading…
Reference in New Issue
Block a user