Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions libbeat/esleg/eslegclient/bulkapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"encoding/json"
"errors"
"io"
"io/ioutil"
"net/http"
"strings"

Expand Down Expand Up @@ -60,16 +59,16 @@ type bulkRequest struct {
requ *http.Request
}

// BulkResult contains the result of a bulk API request.
type BulkResult json.RawMessage
// BulkResponse contains the result of a bulk API request.
type BulkResponse json.RawMessage

// Bulk performs many index/delete operations in a single API call.
// Implements: http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
func (conn *Connection) Bulk(
ctx context.Context,
index, docType string,
params map[string]string, body []interface{},
) (int, BulkResult, error) {
) (int, BulkResponse, error) {
if len(body) == 0 {
return 0, nil, nil
}
Expand Down Expand Up @@ -142,7 +141,7 @@ func (r *bulkRequest) reset(body BodyEncoder) {

rc, ok := bdy.(io.ReadCloser)
if !ok && body != nil {
rc = ioutil.NopCloser(bdy)
rc = io.NopCloser(bdy)
}

switch v := bdy.(type) {
Expand All @@ -160,9 +159,9 @@ func (r *bulkRequest) reset(body BodyEncoder) {
body.AddHeader(&r.requ.Header)
}

func (conn *Connection) sendBulkRequest(requ *bulkRequest) (int, BulkResult, error) {
func (conn *Connection) sendBulkRequest(requ *bulkRequest) (int, BulkResponse, error) {
status, resp, err := conn.execHTTPRequest(requ.requ)
return status, BulkResult(resp), err
return status, BulkResponse(resp), err
}

func bulkEncode(log *logp.Logger, out BulkWriter, body []interface{}) error {
Expand Down
2 changes: 1 addition & 1 deletion libbeat/monitoring/report/elasticsearch/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func getMonitoringIndexName() string {
return fmt.Sprintf(".monitoring-beats-%v-%s", version, date)
}

func logBulkFailures(log *logp.Logger, result eslegclient.BulkResult, events []report.Event) {
func logBulkFailures(log *logp.Logger, result eslegclient.BulkResponse, events []report.Event) {
var response struct {
Items []map[string]map[string]interface{} `json:"items"`
}
Expand Down
4 changes: 2 additions & 2 deletions libbeat/outputs/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ func (c *console) Publish(_ context.Context, batch publisher.Batch) error {
c.writer.Flush()
batch.ACK()

st.Dropped(dropped)
st.Acked(len(events) - dropped)
st.PermanentErrors(dropped)
st.AckedEvents(len(events) - dropped)

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion libbeat/outputs/discard/discard.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (out *discardOutput) Publish(_ context.Context, batch publisher.Batch) erro
st := out.observer
events := batch.Events()
st.NewBatch(len(events))
st.Acked(len(events))
st.AckedEvents(len(events))
return nil
}

Expand Down
Loading