Skip to content

[ML] Inference update API does not validate the updated settings #122356

@davidkyle

Description

@davidkyle

Elasticsearch Version

9.1.0

Installed Plugins

No response

Java Version

bundled

OS Version

any

Problem Description

When updating a service setting such as the api key the new setting should be validated before it is persisted.

Steps to Reproduce

Create a new inference endpoint that requires an api key

PUT _inference/text_embedding/my_embeddings
{
    "service": "cohere",
    "service_settings": {
        "api_key": "XXX",
        "model_id": "embed-english-v3.0"
    }
}

Update the api key

PUT _inference/text_embedding/my_embeddings/_update
{
  "service_settings": {
    "api_key": "not an api key"
  }
}

The update is successful. Next try using the endpoint

POST _inference/my_embeddings
{
  "input": ["foo", "bar"]
}

Inference fails with a message about an invalid api token

Logs (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions