fix: Correctly pickup MRT value for msearch's search requests#138583
Merged
pawankartik-elastic merged 12 commits intoelastic:mainfrom Dec 16, 2025
Merged
fix: Correctly pickup MRT value for msearch's search requests#138583pawankartik-elastic merged 12 commits intoelastic:mainfrom
msearch's search requests#138583pawankartik-elastic merged 12 commits intoelastic:mainfrom
Conversation
Contributor
Author
|
Will mark it as ready once the CI issue is resolved. |
Collaborator
|
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
Collaborator
|
Hi @pawankartik-elastic, I've created a changelog YAML for you. |
quux00
reviewed
Dec 11, 2025
| public void testMrtValuesArePickedCorrectly() throws IOException { | ||
|
|
||
| { | ||
| // If no MRT is specified, all searches should default to true. |
Contributor
There was a problem hiding this comment.
Why does it default to true?
Is that because _msearch always uses _search rather than _async_search and _search defaults to true?
Contributor
Author
There was a problem hiding this comment.
Right. And when the SearchRequest object is instantiated, MRT defaults to true.
Collaborator
💔 Backport failed
You can use sqren/backport to manually backport by running |
pawankartik-elastic
added a commit
to pawankartik-elastic/elasticsearch
that referenced
this pull request
Dec 16, 2025
…tic#138583) Do not override MRT from the request's body with the query param value. (cherry picked from commit 3d0a647) # Conflicts: # server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java
This was referenced Dec 16, 2025
Contributor
Author
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
pawankartik-elastic
added a commit
to pawankartik-elastic/elasticsearch
that referenced
this pull request
Dec 16, 2025
…tic#138583) Do not override MRT from the request's body with the query param value. (cherry picked from commit 3d0a647) # Conflicts: # server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java
pawankartik-elastic
added a commit
to pawankartik-elastic/elasticsearch
that referenced
this pull request
Dec 16, 2025
…tic#138583) Do not override MRT from the request's body with the query param value. (cherry picked from commit 3d0a647) # Conflicts: # server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java
pawankartik-elastic
added a commit
that referenced
this pull request
Dec 16, 2025
pawankartik-elastic
added a commit
that referenced
this pull request
Dec 16, 2025
elasticsearchmachine
pushed a commit
that referenced
this pull request
Dec 16, 2025
#138583) (#139586) * fix: Correctly pickup MRT value for `msearch`'s search requests (#138583) Do not override MRT from the request's body with the query param value. (cherry picked from commit 3d0a647) # Conflicts: # server/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java * Fix CI
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.
Here's the before code:
parseMultiLineRequest()is responsible for parsing themsearch's body. Within this method, we instantiate a newSearchRequestobject for each request and set its MRT to whatever's mentioned in the query parameter (the default fallback value istrue). Then, the body of each request is read byreadMultiLineFormat(), which extracts the MRT value in the request's body (if present) and sets it by overwriting the previously set value. This way, the MRT value in the request body takes precedence over the query parameter.However, when the parsing and reading are done, we end up setting the query param value again before adding the request to the
msearchobject (ref above code and the code comment). Whatever value we read from the request's body is now lost; effectively, we're ignoring whatever value is present in the request's body.The fix is to drop the problematic MRT setting op after the request's parsing is complete.