Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(elasticsearch): output was not using retry_on_conflict option #3179

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all 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
18 changes: 11 additions & 7 deletions internal/impl/elasticsearch/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ type esoConfig struct {
clientOpts []elastic.ClientOptionFunc
backoffCtor func() backoff.BackOff

actionStr *service.InterpolatedString
idStr *service.InterpolatedString
indexStr *service.InterpolatedString
pipelineStr *service.InterpolatedString
routingStr *service.InterpolatedString
typeStr *service.InterpolatedString
actionStr *service.InterpolatedString
idStr *service.InterpolatedString
indexStr *service.InterpolatedString
pipelineStr *service.InterpolatedString
routingStr *service.InterpolatedString
typeStr *service.InterpolatedString
retryOnConflict int
}

func esoConfigFromParsed(pConf *service.ParsedConfig) (conf esoConfig, err error) {
Expand Down Expand Up @@ -180,6 +181,9 @@ func esoConfigFromParsed(pConf *service.ParsedConfig) (conf esoConfig, err error
if conf.typeStr, err = pConf.FieldInterpolatedString(esoFieldType); err != nil {
return
}
if conf.retryOnConflict, err = pConf.FieldInt(esoFieldRetryOnConflict); err != nil {
return
}
return
}

Expand Down Expand Up @@ -398,7 +402,7 @@ func (e *Output) WriteBatch(ctx context.Context, msg service.MessageBatch) error
return fmt.Errorf("failed to marshal message into JSON document: %w", ierr)
}

pbi := &pendingBulkIndex{Doc: jObj}
pbi := &pendingBulkIndex{Doc: jObj, RetryOnConflict: e.conf.retryOnConflict}
if pbi.Action, ierr = msg.TryInterpolatedString(i, e.conf.actionStr); ierr != nil {
return fmt.Errorf("action interpolation error: %w", ierr)
}
Expand Down
Loading