diff --git a/goes.go b/goes.go index a27ba1a..fddf4f3 100644 --- a/goes.go +++ b/goes.go @@ -159,10 +159,10 @@ func (c *Connection) BulkSend(documents []Document) (Response, error) { bulkData[len(bulkData)-1] = []byte(nil) r := Request{ - Conn: c, - method: "POST", - api: "_bulk", - bulkData: bytes.Join(bulkData, []byte("\n")), + Conn: c, + method: "POST", + api: "_bulk", + bulkData: bytes.Join(bulkData, []byte("\n")), } return r.Run() @@ -356,7 +356,7 @@ func (r *Request) Url() string { func (a Aggregation) Buckets() []Bucket { result := []Bucket{} if buckets, ok := a["buckets"]; ok { - for _, bucket := range buckets.([]interface {}) { + for _, bucket := range buckets.([]interface{}) { result = append(result, bucket.(map[string]interface{})) } } @@ -375,7 +375,7 @@ func (b Bucket) DocCount() uint64 { } // Aggregation returns aggregation by name from bucket -func (b Bucket) Aggregation(name string) Aggregation{ +func (b Bucket) Aggregation(name string) Aggregation { if agg, ok := b[name]; ok { return agg.(map[string]interface{}) } else { diff --git a/goes_test.go b/goes_test.go index 663140a..ce27af3 100644 --- a/goes_test.go +++ b/goes_test.go @@ -475,7 +475,7 @@ func (s *GoesTestSuite) TestGet(c *C) { Type: docType, Id: docId, Version: 1, - Found: true, + Found: true, Source: source, } @@ -491,7 +491,7 @@ func (s *GoesTestSuite) TestGet(c *C) { Type: docType, Id: docId, Version: 1, - Found: true, + Found: true, Fields: map[string]interface{}{ "f1": []interface{}{"foo"}, }, @@ -728,7 +728,6 @@ func (s *GoesTestSuite) TestScroll(c *C) { c.Assert(len(searchResults.Hits.Hits), Equals, 0) } - func (s *GoesTestSuite) TestAggregations(c *C) { indexName := "testaggs" docType := "tweet" @@ -740,9 +739,9 @@ func (s *GoesTestSuite) TestAggregations(c *C) { Type: docType, BulkCommand: BULK_COMMAND_INDEX, Fields: map[string]interface{}{ - "user" : "foo", - "message" : "some foo message", - "age" : 25, + "user": "foo", + "message": "some foo message", + "age": 25, }, }, @@ -752,9 +751,9 @@ func (s *GoesTestSuite) TestAggregations(c *C) { Type: docType, BulkCommand: BULK_COMMAND_INDEX, Fields: map[string]interface{}{ - "user" : "bar", - "message" : "some bar message", - "age" : 30, + "user": "bar", + "message": "some bar message", + "age": 30, }, }, @@ -764,8 +763,8 @@ func (s *GoesTestSuite) TestAggregations(c *C) { Type: docType, BulkCommand: BULK_COMMAND_INDEX, Fields: map[string]interface{}{ - "user" : "foo", - "message" : "another foo message", + "user": "foo", + "message": "another foo message", }, }, } @@ -836,5 +835,5 @@ func (s *GoesTestSuite) TestAggregations(c *C) { c.Assert(ok, Equals, true) c.Assert(age["count"], Equals, 2.0) - c.Assert(age["sum"], Equals, 25.0 + 30.0) + c.Assert(age["sum"], Equals, 25.0+30.0) }