Skip to content

Conversation

@tteofili
Copy link
Contributor

@tteofili tteofili commented Mar 3, 2025

see #123731

Copy link
Contributor

@Mikep86 Mikep86 left a comment

Choose a reason for hiding this comment

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

What if we made a new exception type that implemented ElasticsearchWrapperException and always wrapped the exception caught by the failure handler? Something like SearchException in that it takes a message but also takes a cause, and the cause is used to determine the REST status. I see a few benefits to this approach:

  • We can still insert a message indicating that the error happened when performing inference for semantic text, which helps for traceability.
  • The REST status will always be indicative of the wrapped exception. For example, if the wrapped exception is IllegalArgumentException the REST status will be 400.

WDYT?

@tteofili
Copy link
Contributor Author

tteofili commented Mar 5, 2025

@Mikep86 your proposal sounds good to me, thanks!

@tteofili tteofili added >bug :Search Relevance/Search Catch all for Search Relevance labels Mar 5, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@tteofili
Copy link
Contributor Author

tteofili commented Mar 5, 2025

added new InferenceException that wraps another exception, similar to SearchException, but exposing the status according to the wrapped exception.

Copy link
Contributor

@Mikep86 Mikep86 left a comment

Choose a reason for hiding this comment

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

Nice simple approach, love it! Can we add a test showing that this works as expected?

Edit: We should be able to extend testItemFailures to cover this

@Mikep86 Mikep86 added auto-backport Automatically create backport pull requests when merged v8.18.1 v8.19.0 v9.0.1 v8.16.6 v8.17.4 labels Mar 6, 2025
@tteofili tteofili marked this pull request as ready for review March 7, 2025 09:12
@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Mar 7, 2025
@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Contributor

@Mikep86 Mikep86 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for working on this!

@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.18
8.x
9.0
8.16 Commit could not be cherrypicked due to conflicts
8.17 Commit could not be cherrypicked due to conflicts

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

tteofili added a commit to tteofili/elasticsearch that referenced this pull request Mar 7, 2025
elastic#123890)

* do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions
tteofili added a commit to tteofili/elasticsearch that referenced this pull request Mar 7, 2025
elastic#123890)

* do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions
elasticsearchmachine pushed a commit that referenced this pull request Mar 7, 2025
#123890) (#124348)

* do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions
elasticsearchmachine pushed a commit that referenced this pull request Mar 7, 2025
#123890) (#124347)

* do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions
elasticsearchmachine pushed a commit that referenced this pull request Mar 7, 2025
#123890) (#124346)

* do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions
Mikep86 pushed a commit to Mikep86/elasticsearch that referenced this pull request Mar 7, 2025
elastic#123890)

* do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions

(cherry picked from commit 74bb0f9)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/filter/ShardBulkInferenceActionFilter.java
@Mikep86
Copy link
Contributor

Mikep86 commented Mar 7, 2025

💚 All backports created successfully

Status Branch Result
8.17
8.16

Questions ?

Please refer to the Backport tool documentation

Mikep86 pushed a commit to Mikep86/elasticsearch that referenced this pull request Mar 7, 2025
elastic#123890)

* do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions

(cherry picked from commit 74bb0f9)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/filter/ShardBulkInferenceActionFilter.java
elasticsearchmachine pushed a commit that referenced this pull request Mar 7, 2025
…ceptions (#123890) (#124359)

* Do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions (#123890)

* do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions

(cherry picked from commit 74bb0f9)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/filter/ShardBulkInferenceActionFilter.java

* Add missing import

---------

Co-authored-by: Tommaso Teofili <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request Mar 7, 2025
…ceptions (#123890) (#124358)

* Do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions (#123890)

* do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions

(cherry picked from commit 74bb0f9)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/filter/ShardBulkInferenceActionFilter.java

* Add missing import

---------

Co-authored-by: Tommaso Teofili <[email protected]>
georgewallace pushed a commit to georgewallace/elasticsearch that referenced this pull request Mar 11, 2025
elastic#123890)

* do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions
@Mikep86
Copy link
Contributor

Mikep86 commented Apr 4, 2025

@tteofili I addressed a follow-up InferenceException XContent bug in #126345

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/Search Catch all for Search Relevance Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v8.16.6 v8.17.4 v8.18.1 v8.19.0 v9.0.1 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants