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

Handle ES Down Cases More Gracefully in Bulk Indexing #953

Open
sunil-saini opened this issue Feb 9, 2025 · 0 comments
Open

Handle ES Down Cases More Gracefully in Bulk Indexing #953

sunil-saini opened this issue Feb 9, 2025 · 0 comments

Comments

@sunil-saini
Copy link

sunil-saini commented Feb 9, 2025

Hey ES Team,

I am writing a logs tailer program, which tails logs continuously from a file and bulk indexes to elasticsearch

My requirement is to stop indexing If there is any problem in ES, and start again when previously submitted all batches are successfully flushed

Currently if ES is down bulkIndexer.Add() keeps on adding items to indexer and doesn't return any ES error, leading to uncontrolled memory spike of program and if it gets killed in between, all added items are lost

So was trying to understand how to design a flow where can stop adding items to bulk indexer as soon as it detects N no of flush errors and resumes back when these errors falls below N again

I see that flush worker have OnError callback support, so that can be used to detect if there is error in flushing(though if retries are added, it will become complicated to know exact no of errors), but how to resume it back ? like how to detect how many flush errors are remaining now, as there is no OnSuccess function callback for flush workers

One solution i am able to think is frequently checking bulkIndexer.Stats().NumFailed somehow to detect if failures are fixed

Is my understanding correct or there is some native way in library itself to support such requirement ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant