mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
# Backport This will backport the following commits from `main` to `8.17`: - [[Security KB] Fix setup KB (#201175)](https://github.com/elastic/kibana/pull/201175) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Patryk Kopyciński","email":"contact@patrykkopycinski.com"},"sourceCommit":{"committedDate":"2024-11-22T16:58:24Z","message":"[Security KB] Fix setup KB (#201175)\n\n## Summary\r\n\r\nFix an issue with auto-recovery of Knowledge Base setup. \r\n\r\nWhen the KB setup was initialized on an undersized cluster, the model\r\nfailed to deploy correctly. This resulted in the KB ending up in a\r\nbroken state, repeatedly displaying the Setup KB button.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"1cb56d7196cf60b03cb539f32f6a466a17141e02","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","v9.0.0","ci:cloud-deploy","Team:Security Generative AI","backport:version","v8.17.0","v8.18.0","v8.16.2"],"title":"[Security KB] Fix setup KB","number":201175,"url":"https://github.com/elastic/kibana/pull/201175","mergeCommit":{"message":"[Security KB] Fix setup KB (#201175)\n\n## Summary\r\n\r\nFix an issue with auto-recovery of Knowledge Base setup. \r\n\r\nWhen the KB setup was initialized on an undersized cluster, the model\r\nfailed to deploy correctly. This resulted in the KB ending up in a\r\nbroken state, repeatedly displaying the Setup KB button.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"1cb56d7196cf60b03cb539f32f6a466a17141e02"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x","8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201175","number":201175,"mergeCommit":{"message":"[Security KB] Fix setup KB (#201175)\n\n## Summary\r\n\r\nFix an issue with auto-recovery of Knowledge Base setup. \r\n\r\nWhen the KB setup was initialized on an undersized cluster, the model\r\nfailed to deploy correctly. This resulted in the KB ending up in a\r\nbroken state, repeatedly displaying the Setup KB button.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"1cb56d7196cf60b03cb539f32f6a466a17141e02"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
This commit is contained in:
parent
042993df55
commit
252fbfd3de
1 changed files with 18 additions and 2 deletions
|
@ -178,9 +178,22 @@ export class AIAssistantKnowledgeBaseDataClient extends AIAssistantDataClient {
|
|||
public createInferenceEndpoint = async () => {
|
||||
const elserId = await this.options.getElserId();
|
||||
this.options.logger.debug(`Deploying ELSER model '${elserId}'...`);
|
||||
try {
|
||||
const esClient = await this.options.elasticsearchClientPromise;
|
||||
const esClient = await this.options.elasticsearchClientPromise;
|
||||
|
||||
try {
|
||||
await esClient.inference.delete({
|
||||
inference_id: ASSISTANT_ELSER_INFERENCE_ID,
|
||||
// it's being used in the mapping so we need to force delete
|
||||
force: true,
|
||||
});
|
||||
this.options.logger.debug(`Deleted existing inference endpoint for ELSER model '${elserId}'`);
|
||||
} catch (error) {
|
||||
this.options.logger.error(
|
||||
`Error deleting inference endpoint for ELSER model '${elserId}':\n${error}`
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
await esClient.inference.put({
|
||||
task_type: 'sparse_embedding',
|
||||
inference_id: ASSISTANT_ELSER_INFERENCE_ID,
|
||||
|
@ -198,6 +211,9 @@ export class AIAssistantKnowledgeBaseDataClient extends AIAssistantDataClient {
|
|||
task_settings: {},
|
||||
},
|
||||
});
|
||||
|
||||
// await for the model to be deployed
|
||||
await this.isInferenceEndpointExists();
|
||||
} catch (error) {
|
||||
this.options.logger.error(
|
||||
`Error creating inference endpoint for ELSER model '${elserId}':\n${error}`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue