Skip to content

Fix msearch request parsing when index expression is null #130776

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 3 commits into
base: main
Choose a base branch
from

Conversation

smalyshev
Copy link
Contributor

Method XContentMapValues.nodeStringArrayValue does not check for null before trying to manipulate the value, but null is a legit value that can come from JSON, we should check for it.

Fixes #129631

@smalyshev smalyshev added the >bug label Jul 7, 2025
@smalyshev smalyshev changed the title Fix parsing when index expression is null Fix msearch request parsing when index expression is null Jul 7, 2025
@smalyshev smalyshev added :Search Foundations/Search Catch all for Search Foundations :Core/Infra/Core Core issues without another label auto-backport Automatically create backport pull requests when merged v9.1.0 v9.0.0 v8.19.0 labels Jul 7, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @smalyshev, I've created a changelog YAML for you.

@smalyshev smalyshev requested a review from astefan July 7, 2025 23:48
@smalyshev smalyshev marked this pull request as ready for review July 7, 2025 23:59
@smalyshev smalyshev requested a review from a team as a code owner July 7, 2025 23:59
@elasticsearchmachine elasticsearchmachine added Team:Core/Infra Meta label for core/infra team Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch labels Jul 8, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-foundations (Team:Search Foundations)

@@ -537,6 +538,14 @@ public void testFailOnExtraCharacters() throws IOException {
}
}

public void testNullIndex() throws IOException {
try {
MultiSearchRequest request = parseMultiSearchRequest("/org/elasticsearch/action/search/msearch-null.json");
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a case of personal preference, but have you considered inlining the JSON directly?
Since the request is only a couple of lines, inlining it would improve readability and make the test easier to follow at a glance, especially for a simple case like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged >bug :Core/Infra/Core Core issues without another label :Search Foundations/Search Catch all for Search Foundations Team:Core/Infra Meta label for core/infra team Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v8.17.9 v8.18.4 v8.19.0 v9.0.0 v9.1.0 v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE in XContentMapValues via MultiSearchRequest
3 participants