[BUG] Model Group does not update lastUpdatedTime #3408
Description
(Good First issue!)
What is the bug?
Currently model groups have a created time field and a last updated time field. However the updated time won't update accordingly on update.
This problem is very similar to this one which involves updating the time just before indexing the connector (#2890).
How can one reproduce the bug?
Steps to reproduce the behavior:
- Create the model group
curl --request POST \
--url http://localhost:9200/_plugins/_ml/model_groups/_register \
--header 'Content-Type: application/json' \
--header 'User-Agent: insomnia/10.0.0' \
--data '{
"name": "Asymmetric Model Group",
"description": "A model group for local asymmetric models"
}'
- Inspect the time
curl --request GET \
--url http://localhost:9200/_plugins/_ml/model_groups/RfW-dZQBGaSTjkdpLdZQ \
--header 'Content-Type: application/json'
## you get
{
"name": "Asymmetric Model Group",
"latest_version": 0,
"description": "A model group for local asymmetric models",
"access": "public",
"created_time": 1737142185135,
"last_updated_time": 1737142185135 <--- Take note
}
- Update the model group
curl --request PUT \
--url http://localhost:9200/_plugins/_ml/model_groups/RfW-dZQBGaSTjkdpLdZQ \
--header 'Content-Type: application/json' \
--header 'User-Agent: insomnia/10.0.0' \
--data '{
"name": "Asymmetric Model Group",
"description": "I want to update this"
}'
- Inspect the time again
curl --request GET \
--url http://localhost:9200/_plugins/_ml/model_groups/RfW-dZQBGaSTjkdpLdZQ \
--header 'Content-Type: application/json'
{
"name": "Asymmetric Model Group",
"latest_version": 0,
"description": "I want to update this",
"access": "public",
"created_time": 1737142185135,
"last_updated_time": 1737142185135 <------ problem is here
}
What is the expected behavior?
the last_updated_time
ought to be updated
What is your host/environment?
- OS: [e.g. iOS]
- Version [e.g. 22]
- Plugins
Do you have any screenshots?
If applicable, add screenshots to help explain your problem.
Do you have any additional context?
You can follow a similar solution on this PR (#2890). Try looking for the section of code that involves the update of the model group and just before it gets indexed update the time there