Skip to content

Commit

Permalink
Use default elser deployment for product documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Dec 18, 2024
1 parent d6cb398 commit ce6157b
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 245 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ export {
} from './src/errors';

export { truncateList } from './src/truncate_list';
export { defaultInferenceEndpoints } from './src/inference_endpoints';
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* 2.0.
*/

export { waitUntilModelDeployed } from './wait_until_model_deployed';
export { getModelInstallStatus } from './get_model_install_status';
export { installElser } from './install_elser';
/**
* Constants for all default (preconfigured) inference endpoints.
*/
export const defaultInferenceEndpoints = {
ELSER: '.elser-2-elasticsearch',
MULTILINGUAL_E5_SMALL: '.multilingual-e5-small-elasticsearch',
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
* 2.0.
*/

import { defaultInferenceEndpoints } from '@kbn/inference-common';

export const productDocInstallStatusSavedObjectTypeName = 'product-doc-install-status';

/**
* The id of the inference endpoint we're creating for our product doc indices.
* Could be replaced with the default elser 2 endpoint once the default endpoint feature is available.
*/
export const internalElserInferenceId = 'kibana-internal-elser2';
export const internalElserInferenceId = defaultInferenceEndpoints.ELSER;

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ import {
type ProductName,
} from '@kbn/product-doc-common';
import type { ProductDocInstallClient } from '../doc_install_status';
import type { InferenceEndpointManager } from '../inference_endpoint';
import { downloadToDisk, openZipArchive, loadMappingFile, type ZipArchive } from './utils';
import {
downloadToDisk,
openZipArchive,
loadMappingFile,
ensureDefaultElserDeployed,
type ZipArchive,
} from './utils';
import { majorMinor, latestVersion } from './utils/semver';
import {
validateArtifactArchive,
Expand All @@ -39,7 +44,6 @@ export class PackageInstaller {
private readonly artifactsFolder: string;
private readonly esClient: ElasticsearchClient;
private readonly productDocClient: ProductDocInstallClient;
private readonly endpointManager: InferenceEndpointManager;
private readonly artifactRepositoryUrl: string;
private readonly currentVersion: string;

Expand All @@ -55,7 +59,6 @@ export class PackageInstaller {
this.esClient = esClient;
this.productDocClient = productDocClient;
this.artifactsFolder = artifactsFolder;
this.endpointManager = endpointManager;
this.artifactRepositoryUrl = artifactRepositoryUrl;
this.currentVersion = majorMinor(kibanaVersion);
this.log = logger;
Expand Down Expand Up @@ -144,7 +147,7 @@ export class PackageInstaller {
productVersion,
});

await this.endpointManager.ensureInternalElserInstalled();
await ensureDefaultElserDeployed({ client: this.esClient });

const artifactFileName = getArtifactName({ productName, productVersion });
const artifactUrl = `${this.artifactRepositoryUrl}/${artifactFileName}`;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import type { ElasticsearchClient } from '@kbn/core/server';
import { defaultInferenceEndpoints } from '@kbn/inference-common';

export const ensureDefaultElserDeployed = async ({ client }: { client: ElasticsearchClient }) => {
await client.inference.inference(
{
inference_id: defaultInferenceEndpoints.ELSER,
input: 'I just want to call the API to force the model to download and allocate',
},
{ requestTimeout: 10 * 60 * 1000 }
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
export { downloadToDisk } from './download';
export { openZipArchive, type ZipArchive } from './zip_archive';
export { loadManifestFile, loadMappingFile } from './archive_accessors';
export { ensureDefaultElserDeployed } from './ensure_default_elser_deployed';

0 comments on commit ce6157b

Please sign in to comment.