Skip to content

Conversation

@jonathan-buttner
Copy link
Contributor

@jonathan-buttner jonathan-buttner commented Aug 1, 2025

This PR disables partial search results when retrieving the inference endpoint information from the configuration and secrets index. This should bubble up the originating exception for the reason that the document from each index is not available. If an unexpected exception occurs it is wrapped in an ElasticsearchException to include the inference endpoint that is failing.

@jonathan-buttner jonathan-buttner added >bug :ml Machine learning Team:ML Meta label for the ML team v9.2.0 labels Aug 1, 2025
@jonathan-buttner jonathan-buttner linked an issue Aug 1, 2025 that may be closed by this pull request
@elasticsearchmachine
Copy link
Collaborator

Hi @jonathan-buttner, I've created a changelog YAML for you.

public static class LocalStateIndexSettingsInferencePlugin extends LocalStateCompositeXPackPlugin {
private final InferencePlugin inferencePlugin;

public LocalStateIndexSettingsInferencePlugin(final Settings settings, final Path configPath) throws Exception {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you can think of a better way to direct the inference configuration index and secrets index to separate nodes let me know. I'm injecting some settings that won't be present in production but allows us to direct the documents to specific nodes for easier testing.

assertThat(exception.toString(), containsString("Failed to load inference endpoint [test-index-id]"));

var causeException = exception.getCause();
assertThat(causeException, instanceOf(SearchPhaseExecutionException.class));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried adding more assertThat's for looking for certain text in the search phase execution exception, but they exact wording changes during my test runs and was causing the test to be flaky.

@jonathan-buttner jonathan-buttner marked this pull request as ready for review August 5, 2025 12:54
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

Copy link
Contributor

@przemekwitek przemekwitek left a comment

Choose a reason for hiding this comment

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

LGTM

* This allows tests to set additional settings for the inference index.
* @param extraSettings additional settings to apply to the inference index.
*/
public static Settings settingsForTesting(Settings extraSettings) {
Copy link
Member

Choose a reason for hiding this comment

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

Can the 2 settingsForTesting() functions be moved to the test code? That would keep this cleaner

@jonathan-buttner jonathan-buttner merged commit 5584aaa into elastic:main Aug 5, 2025
33 checks passed
@jonathan-buttner jonathan-buttner deleted the inference-api-disable-partial-results branch August 5, 2025 16:38
szybia added a commit to szybia/elasticsearch that referenced this pull request Aug 6, 2025
…cking

* upstream/main: (24 commits)
  Revert "[Fleet] add privileges to `kibana_system` to read integrations data (elastic#132400)" (elastic#132499)
  ESQL: Rename evaluators for FIRST and LAST (elastic#132466)
  Add inference fields to semantic text docs (elastic#132471)
  ESQL: Allow FIRST and LAST as method name (elastic#132469)
  ESQL: Add javadoc for PushDownAndCombineFilters (elastic#132484)
  Misc cleanups in Coordinator (elastic#132452)
  [DiskBBQ] Write the maximum posting list size to avoid resizing the docId array (elastic#132447)
  Improve exception handling for JsonXContentParser (elastic#123439)
  Clarify quantization on semantic_text BBQ dense vector default (elastic#132470)
  Fix test infra NPE in doEnsureClusterStateConsistency (elastic#131859)
  Stabilize CancellableTasksIT#testRemoveBanParentsOnDisconnect (elastic#131858)
  Move ClusterApplierService assertion after logging exception (elastic#132446)
  ESQL: Support for multi-argument aggs (elastic#132424)
  Update wolfi (versioned) (elastic#132457)
  ESQL: Fix Function javadoc (elastic#132399)
  [ML] Inference API disable partial search results (elastic#132362)
  Unmute testTermsQuery tests (elastic#132409)
  Fix index lookup when field-caps returns empty mapping (elastic#132138)
  CompressorFactory.compressor (elastic#132448)
  ESQL add formatting to plans in javadoc (elastic#132421)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :ml Machine learning Team:ML Meta label for the ML team v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ML] Inference API unable to retrieve inference endpoint

4 participants