Skip to content

[BUG] Model group doesn't not deleted automatically with the last model version in that group #4536

@martin-gaievski

Description

@martin-gaievski

What is the bug?
Model group remains in the system after the last model version in that group is deleted. This contradicts documentation that says:

When you delete the last model version in a model group, that model group is automatically deleted from the index.

https://docs.opensearch.org/latest/ml-commons-plugin/api/model-apis/delete-model/

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Setup remote connector using these steps:
  • Create model group
  • Create model and reference the new model group, deploy the model
  • Create connector that points to the new model
    I used following API and deployed remote Cohere model using flow framework, but you can do same manually:
POST /_plugins/_flow_framework/workflow?use_case=cohere_embedding_model_deploy&provision=true
{
    "create_connector.credential.key" : "<YOUR_API_KEY"
}

Check the all three items exist

  1. Undeploy model, delete connector, delete model
POST /_plugins/_ml/models/iKa8uJsBH57jLXRJEA7F/_undeploy

DELETE /_plugins/_ml/model_groups/gKa3r5sBH57jLXRJ5Q4B

DELETE /_plugins/_ml/models/iKa8uJsBH57jLXRJEA7F
  1. Check model_group, it's still present in the system
GET /_plugins/_ml/model_groups/_search
{
  "query": {
    "match_all": {}
  }
}

            {
                "_index": ".plugins-ml-model-group",
                "_id": "hqa8uJsBH57jLXRJEA6Y",
                "_version": 2,
                "_seq_no": 9,
                "_primary_term": 1,
                "_score": 1.0,
                "_source": {
                    "created_time": 1768330891415,
                    "access": "public",
                    "latest_version": 1,
                    "last_updated_time": 1768330891442,
                    "name": "Cohere english embed model",
                    "description": "cohere-embedding-model"
                }
            }

get by id request return the same document, so it's not the stale/cached data problem:

GET /_plugins/_ml/model_groups/hqa8uJsBH57jLXRJEA6Y
{
  "name": "Cohere english embed model",
  "latest_version": 1,
  "description": "cohere-embedding-model",
  "access": "public",
  "created_time": 1768330891415,
  "last_updated_time": 1768330891442
}

What is the expected behavior?
Model group is delete together with the single model accossiated with it

What is your host/environment?

  • Version 3.3
  • Plugins: flow-framework (optional, you can do everything manually)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions