Skip to content

Conversation

@iverase
Copy link
Contributor

@iverase iverase commented Apr 7, 2025

This class throws an error if more than maxExpansions terms are found and hardLimit is set. The current error thrown is a RuntimeEception which Elasticsearch cannot handle. This commit proposes to change it to an exception that can be handle by Elasticsearch. More over, the rest status of such a request should be different to 500 as this is expected for such a request.

We are proposing to throw an ElasticsearchStatusException with a RestStatus.BAD_REQUEST code.

@elasticsearchmachine elasticsearchmachine added the Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch label Apr 7, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@iverase iverase added :Search Relevance/Search Catch all for Search Relevance and removed :Search Foundations/Search Catch all for Search Foundations labels Apr 7, 2025
@elasticsearchmachine elasticsearchmachine added Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch and removed Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch labels Apr 7, 2025
@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Contributor

@john-wagster john-wagster left a comment

Choose a reason for hiding this comment

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

lgtm

@iverase iverase added the auto-backport Automatically create backport pull requests when merged label Apr 8, 2025
@iverase iverase merged commit 47e352f into elastic:main Apr 8, 2025
17 checks passed
@iverase iverase deleted the SpanBooleanQueryRewriteWithMaxClause branch April 8, 2025 04:42
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.x Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 126387

iverase added a commit to iverase/elasticsearch that referenced this pull request Apr 8, 2025
…c#126387)

Throw an ElasticsearchStatusException with a RestStatus.BAD_REQUEST code instead of a generic RuntimeException.
# Conflicts:
#	server/src/main/java/org/elasticsearch/common/lucene/search/SpanBooleanQueryRewriteWithMaxClause.java
elasticsearchmachine pushed a commit that referenced this pull request Apr 8, 2025
…126387) (#126439)

* Throw nicer exception in SpanBooleanQueryRewriteWithMaxClause (#126387)

Throw an ElasticsearchStatusException with a RestStatus.BAD_REQUEST code instead of a generic RuntimeException.
# Conflicts:
#	server/src/main/java/org/elasticsearch/common/lucene/search/SpanBooleanQueryRewriteWithMaxClause.java

* iter
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 >non-issue :Search Relevance/Search Catch all for Search Relevance Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants