removed index param from BulkSend
This commit is contained in:
parent
cdd62356b9
commit
45e977fe8a
7
goes.go
7
goes.go
@ -100,9 +100,9 @@ func (c *Connection) IndexStatus(indexList []string) (Response, error) {
|
||||
return r.Run()
|
||||
}
|
||||
|
||||
// Bulk adds multiple documents in bulk mode to the index for a given type
|
||||
func (c *Connection) BulkSend(index string, documents []Document) (Response, error) {
|
||||
// We do not generate a traditionnal JSON here (often a one liner)
|
||||
// Bulk adds multiple documents in bulk mode
|
||||
func (c *Connection) BulkSend(documents []Document) (Response, error) {
|
||||
// We do not generate a traditional JSON here (often a one liner)
|
||||
// Elasticsearch expects one line of JSON per line (EOL = \n)
|
||||
// plus an extra \n at the very end of the document
|
||||
//
|
||||
@ -160,7 +160,6 @@ func (c *Connection) BulkSend(index string, documents []Document) (Response, err
|
||||
|
||||
r := Request{
|
||||
Conn: c,
|
||||
IndexList: []string{index},
|
||||
method: "POST",
|
||||
api: "_bulk",
|
||||
bulkData: bytes.Join(bulkData, []byte("\n")),
|
||||
|
10
goes_test.go
10
goes_test.go
@ -195,7 +195,7 @@ func (s *GoesTestSuite) TestBulkSend(c *C) {
|
||||
tweets := []Document{
|
||||
Document{
|
||||
Id: "123",
|
||||
Index: nil,
|
||||
Index: indexName,
|
||||
Type: docType,
|
||||
BulkCommand: BULK_COMMAND_INDEX,
|
||||
Fields: map[string]interface{}{
|
||||
@ -221,7 +221,7 @@ func (s *GoesTestSuite) TestBulkSend(c *C) {
|
||||
_, err := conn.CreateIndex(indexName, nil)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
response, err := conn.BulkSend(indexName, tweets)
|
||||
response, err := conn.BulkSend(tweets)
|
||||
i := Item{
|
||||
Id: "123",
|
||||
Type: docType,
|
||||
@ -277,7 +277,7 @@ func (s *GoesTestSuite) TestBulkSend(c *C) {
|
||||
},
|
||||
}
|
||||
|
||||
response, err = conn.BulkSend(indexName, docToDelete)
|
||||
response, err = conn.BulkSend(docToDelete)
|
||||
i = Item{
|
||||
Id: "123",
|
||||
Type: docType,
|
||||
@ -681,7 +681,7 @@ func (s *GoesTestSuite) TestScroll(c *C) {
|
||||
_, err := conn.CreateIndex(indexName, mapping)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
_, err = conn.BulkSend(indexName, tweets)
|
||||
_, err = conn.BulkSend(tweets)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
_, err = conn.RefreshIndex(indexName)
|
||||
@ -784,7 +784,7 @@ func (s *GoesTestSuite) TestAggregations(c *C) {
|
||||
_, err := conn.CreateIndex(indexName, mapping)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
_, err = conn.BulkSend(indexName, tweets)
|
||||
_, err = conn.BulkSend(tweets)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
_, err = conn.RefreshIndex(indexName)
|
||||
|
Loading…
Reference in New Issue
Block a user