Skip to content

Add property to configure Elasticsearch's response timeout - #52436

Open
beyondwin wants to merge 1 commit into
spring-projects:mainfrom
beyondwin:es-socket-timeout
Open

beyondwin wants to merge 1 commit into
spring-projects:mainfrom
beyondwin:es-socket-timeout

Conversation

@beyondwin

@beyondwin beyondwin commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Rest5ClientBuilder sets the request config's response timeout to 0
(infinite), which HttpClient 5 uses in place of the connection's
socket timeout while a request is executing. A node that accepts the
connection but never responds therefore blocks callers of the
auto-configured Rest5Client, including the health indicator,
indefinitely, and changing that requires a Rest5ClientBuilderCustomizer.

This commit adds a spring.elasticsearch.response-timeout property that
is mapped to the request config's response timeout. When it is not
set, the client's default is kept.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue that has not yet been triaged. Contributions will not be accepted. label Oct 27, 2026

@wilkinsona wilkinsona left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

I don't think doubling the purpose of the socket timeout and applying it as the response timeout is the right thing to do. Presumably, the Elasticsearch client code uses an infinite timeout by default for a reason. Any change we make in Boot should allow someone to tune the socket timeout without inadvertently overriding that default.

If a change is warranted here, I think we should introduce a separate property so that the different settings in the HTTP 5 Client remain separated in Boot's configuration.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Oct 27, 2026
@beyondwin

Copy link
Copy Markdown
Contributor Author

Thanks for the review. That makes sense, and keeping the client's default unless someone opts in is better than what I did here.

How about a new spring.elasticsearch.response-timeout property with no default, mapped to the request config's response timeout, so that it can be set without a customizer? If that works for you, I'll update this PR. I'm happy to keep it on 4.0.x or rebase it onto main, whichever you prefer.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Oct 27, 2026
@wilkinsona

Copy link
Copy Markdown
Member

Thanks, @beyondwin. The proposed property (spring.elasticsearch.response-timeout) targeting main sounds good to me.

@wilkinsona wilkinsona added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Oct 29, 2026
Rest5ClientBuilder sets the request config's response timeout to 0
(infinite), which HttpClient 5 uses in place of the connection's
socket timeout while a request is executing. A node that accepts the
connection but never responds therefore blocks callers of the
auto-configured Rest5Client, including the health indicator,
indefinitely, and changing that requires a Rest5ClientBuilderCustomizer.

This commit adds a spring.elasticsearch.response-timeout property that
is mapped to the request config's response timeout. When it is not
set, the client's default is kept.

Signed-off-by: WooSeung Kim <wooseung.dev@gmail.com>
@beyondwin
beyondwin changed the base branch from 4.0.x to main October 29, 2026 10:55
@beyondwin beyondwin changed the title Apply Elasticsearch socket timeout to responses Add property to configure Elasticsearch's response timeout Oct 29, 2026
@beyondwin

Copy link
Copy Markdown
Contributor Author

Thanks, I've reworked the PR to add spring.elasticsearch.response-timeout and rebased it onto main.

@wilkinsona wilkinsona added type: enhancement A general enhancement and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue that has not yet been triaged. Contributions will not be accepted. labels Oct 29, 2026
@wilkinsona wilkinsona added this to the 4.x milestone Oct 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants