ml-commons
ml-commons copied to clipboard
[BUG] Created Time and Last Updated Time are not implemented on Connector
What is the bug?
The .plugin-ml-connector index contains field mappings for created_time and last_updated_time but these are never populated.
How can one reproduce the bug? Steps to reproduce the behavior:
- Create a connector.
- Inspect the created document using the REST API
- Observe there are no
created_timeorlast_updated_timefields.
What is the expected behavior?
- the created and last updated time are both populated with the same
Instant.now()upon instantiation, or at least set before index request - the last updated time is updated before an update request
What is your host/environment?
OpenSearch :)
Do you have any screenshots?
http://localhost:9200/.plugins-ml-connector/_doc/44ymvpEBPIzofVXwNZHj
{
"_index": ".plugins-ml-connector",
"_id": "44ymvpEBPIzofVXwNZHj",
"_version": 1,
"_seq_no": 0,
"_primary_term": 1,
"found": true,
"_source": {
"name": "Cohere Chat Model",
"version": "1",
"description": "The connector to Cohere's public chat API",
"protocol": "http",
"parameters": {
"model": "command"
},
"credential": {
"cohere_key": "REDACTED"
},
"actions": [
{
"action_type": "PREDICT",
"method": "POST",
"url": "https://api.cohere.ai/v1/chat",
"headers": {
"Authorization": "Bearer ${credential.cohere_key}",
"Request-Source": "unspecified:opensearch"
},
"request_body": "{ \"message\": \"${parameters.inputs}\", \"model\": \"${parameters.model}\" }"
}
]
}
}
Do you have any additional context?
The HttpConnector class has fields for createdTime and lastUpdatedTime which are properly parsed from incoming transport or XContent, and properly sent to outgoing transport or XContent unless null. The problem is that they are always null.
- there are no setters for them
- they are never given any values
Suggested fix(es):
- in the AbstractConnector, assign them a value on instantiating. (Use the same value for both.)
- Add a setter for the updated time
- Set the updated time when using the UpdateConnector API.
Can I get assigned this bug?