这是indexloc提供的服务,不要输入任何密码
Skip to content

feat(elasticsearch): add configurable timeout and retry mechanisms #8770

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cutiechi
Copy link
Contributor

What problem does this PR solve?

Currently, the retry attempts and timeout values for Elasticsearch (ES) requests are not configurable, and some APIs—such as exists—use an unreasonable default timeout of 600 seconds.

In the current implementation, the number of retries and the timeout duration for ES requests are hardcoded and cannot be adjusted through configuration. This means that all API operations, regardless of their nature, use the same default values. For example, the exists API, which is typically a quick check, also uses the default 600-second timeout. This is not appropriate, as such a long timeout is excessive for simple existence checks and can lead to inefficient resource usage and delayed error handling.

Making these parameters configurable allows for more fine-grained control, so each API can have retry and timeout settings that match its expected behavior and performance requirements.

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

- Add per-API timeout configuration with fallback to hardcoded defaults
- Add per-API retry attempts configuration with global fallback
- Support APIs: exists, get, search, bulk, update, delete_by_query, sql, health
- Maintain backward compatibility with previous hardcoded values as defaults
- Optimize code structure with extracted _init_config method and constants
- Update configuration documentation and Docker templates

Breaking changes: None (fully backward compatible)
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 💞 feature Feature request, pull request that fullfill a new feature. 📖 documentation Improvements or additions to documentation labels Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 documentation Improvements or additions to documentation 💞 feature Feature request, pull request that fullfill a new feature. size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant