Skip to content

Conversation

@afoucret
Copy link
Contributor

Fixes #138361

@afoucret afoucret added >bug auto-backport Automatically create backport pull requests when merged :Search Relevance/ES|QL Search functionality in ES|QL v9.3.0 v9.2.2 labels Nov 20, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Nov 20, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

@elasticsearchmachine
Copy link
Collaborator

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

}

Map<String, Expression> optionsMap = visitCommandNamedParameters(ctx).keyFoldedMap();
Map<String, Expression> optionsMap = optionsExpression.keyFoldedMap();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ℹ️ For whatever reason (abuse of pizzas?) I was not reusing the optionExpression while it was the right things to do.

// completely change the syntax in the future.
throw new ParsingException(source(ctx), "Missing mandatory option [{}] in COMPLETION", Completion.INFERENCE_ID_OPTION_NAME);
throw new ParsingException(
completion.source(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ℹ️ Using completion.source instead of source(ctx). Avoid StringIndexOutOfBoundsException that were cause when options were missing (ctx is null)

@afoucret afoucret requested review from a team and carlosdelest November 20, 2025 13:06
Copy link
Member

@kderusso kderusso left a comment

Choose a reason for hiding this comment

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

LGTM

@afoucret afoucret changed the title Fix StringIndexOutOfBoundsException in COMPLETION command when option… Fix StringIndexOutOfBoundsException in COMPLETION command when options are omitted. Nov 20, 2025
@afoucret afoucret merged commit 38fa6d6 into elastic:main Nov 20, 2025
34 checks passed
afoucret added a commit to afoucret/elasticsearch that referenced this pull request Nov 20, 2025
elasticsearchmachine pushed a commit that referenced this pull request Nov 20, 2025
ncordon pushed a commit to ncordon/elasticsearch that referenced this pull request Nov 26, 2025
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 :Search Relevance/ES|QL Search functionality in ES|QL Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.2.2 v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StringIndexOutOfBoundsException in ESQL COMPLETION command when optional parameters are omitted

3 participants