Fix: Preserve Elasticsearch URL path in stats requests - #1123
Open
Robert-Steiner wants to merge 1 commit into
Open
Fix: Preserve Elasticsearch URL path in stats requests#1123Robert-Steiner wants to merge 1 commit into
Robert-Steiner wants to merge 1 commit into
Conversation
Signed-off-by: Robert Steiner <robert.steiner@noxtua.com>
Robert-Steiner
force-pushed
the
fix/all-path
branch
from
January 15, 2026 15:32
71763e4 to
e6ad4f9
Compare
ArthurSens
requested changes
Aug 25, 2026
ArthurSens
left a comment
Contributor
There was a problem hiding this comment.
Hi @Robert-Steiner, sorry for the delay here. Looks like the PR needs a rebase now.
Also, could you add a test to prevent us from re-introducing this bug again in the future?
| var isr indexStatsResponse | ||
|
|
||
| u := i.url.ResolveReference(&url.URL{Path: "/_all/_stats"}) | ||
| u := i.url.ResolveReference(&url.URL{Path: "_all/_stats"}) |
Contributor
There was a problem hiding this comment.
Maybe we should be using i.url.JoinPath here?
Contributor
There was a problem hiding this comment.
Based on my research, I think JoinPath should become our standard. It covers the prefix needs we have.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When the Elasticsearch URL contains a path (e.g.,
http://example.com/elasticsearch/), the path is incorrectly stripped when making_all/_statsrequests, resulting in requests tohttp://example.com/_all/_statsinstead ofhttp://example.com/elasticsearch/_all/_stats.The regression was introduced in v1.10.0 when the URL resolution logic was changed from using
path.Jointourl.ResolveReference.Output
This PR fixes the URL path handling to ensure custom paths in the Elasticsearch URL are properly preserved when constructing API endpoint requests.