Skip to content

Commit

Permalink
Update dependency @elastic/elasticsearch to ^8.17.1 (8.x) (#213283)
Browse files Browse the repository at this point in the history
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[@elastic/elasticsearch](http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html)
([source](https://github.com/elastic/elasticsearch-js)) |
dependencies | patch | [`^8.17.0` ->
`^8.17.1`](https://renovatebot.com/diffs/npm/@elastic%2felasticsearch/8.17.0/8.17.1)
|

---

### Release Notes

<details>
<summary>elastic/elasticsearch-js
(@&#8203;elastic/elasticsearch)</summary>

###
[`v8.17.1`](https://github.com/elastic/elasticsearch-js/releases/tag/v8.17.1)

[Compare
Source](https://github.com/elastic/elasticsearch-js/compare/v8.17.0...v8.17.1)


[Changelog](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/8.17/changelog-client.html)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://github.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMDcuMCIsInVwZGF0ZWRJblZlciI6IjM5LjEwNy4wIiwidGFyZ2V0QnJhbmNoIjoiOC54IiwibGFiZWxzIjpbIlRlYW06Q29yZSIsIlRlYW06T3BlcmF0aW9ucyIsImJhY2twb3J0OnNraXAiLCJyZWxlYXNlX25vdGU6c2tpcCJdfQ==-->

---------

Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
Co-authored-by: Alejandro Fernández Haro <[email protected]>
  • Loading branch information
elastic-renovate-prod[bot] and afharo authored Mar 7, 2025
1 parent 8124d5d commit e2e52c8
Show file tree
Hide file tree
Showing 38 changed files with 137 additions and 131 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"@elastic/datemath": "5.0.3",
"@elastic/ebt": "^1.1.1",
"@elastic/ecs": "^8.11.5",
"@elastic/elasticsearch": "^8.17.0",
"@elastic/elasticsearch": "^8.17.1",
"@elastic/ems-client": "8.6.3",
"@elastic/eui": "99.3.0-classic.0",
"@elastic/filesaver": "1.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export function getCommonDefaultAsyncSubmitParams(
}
): Pick<
AsyncSearchSubmitRequest,
// @ts-expect-error 'keep_alive' has been removed from the spec due to a misunderstanding, but it still works
'keep_alive' | 'wait_for_completion_timeout' | 'keep_on_completion'
> {
const useSearchSessions =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export async function getDefaultAsyncSubmitParams(
): Promise<
Pick<
AsyncSearchSubmitRequest,
// @ts-expect-error 'keep_alive' has been removed from the spec due to a misunderstanding, but it still works
| 'batched_reduce_size'
| 'ccs_minimize_roundtrips'
| 'keep_alive'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
*/

import dateMath from '@kbn/datemath';
import type {
IngestPipeline,
IngestSimulateDocument,
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { IngestPipeline, IngestDocument } from '@elastic/elasticsearch/lib/api/types';
import type { IScopedClusterClient } from '@kbn/core/server';

type Doc = IngestSimulateDocument['_source'];
type Doc = IngestDocument;

/**
* Returns the start and end time range in epoch milliseconds for a given set of documents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ const indexWithLifecyclePhaseDefinition: Index = {
step_time_millis: 1544187776208,
phase_execution: {
policy: 'testy',
// @ts-expect-error ILM type is incorrect https://github.com/elastic/elasticsearch-specification/issues/2326
phase_definition: { min_age: '0s', actions: { rollover: { max_size: '1gb' } } },
version: 1,
modified_date_in_millis: 1544031699844,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { euiThemeVars } from '@kbn/ui-theme';
import { ApplicationStart } from '@kbn/core/public';
import { Index, IndexDetailsTab } from '@kbn/index-management-shared-types';
import { IlmExplainLifecycleLifecycleExplainManaged } from '@elastic/elasticsearch/lib/api/types';
import type { EuiDescriptionListProps } from '@elastic/eui/src/components/description_list/description_list_types';
import { Phase } from '../../../common/types';
import { getPolicyEditPath } from '../../application/services/navigation';

Expand Down Expand Up @@ -69,15 +70,15 @@ export const IndexLifecycleSummary: FunctionComponent<Props> = ({ index, getUrlF
color: 'default',
label: ilm.phase,
};
const lifecycleProperties = [
const lifecycleProperties: EuiDescriptionListProps['listItems'] = [
{
title: i18n.translate(
'xpack.indexLifecycleMgmt.indexLifecycleMgmtSummary.headers.policyNameTitle',
{
defaultMessage: 'Policy name',
}
),
description: ilm.policy,
description: ilm.policy!,
},
{
title: i18n.translate(
Expand Down Expand Up @@ -147,7 +148,7 @@ export const IndexLifecycleSummary: FunctionComponent<Props> = ({ index, getUrlF
<EuiLink
color="primary"
href={getUrlForApp('management', {
path: `data/index_lifecycle_management/${getPolicyEditPath(ilm.policy)}`,
path: `data/index_lifecycle_management/${getPolicyEditPath(ilm.policy!)}`,
})}
target="_blank"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ describe('EPM index template install', () => {
}

expect(packageTemplate.settings?.index?.mapping).toHaveProperty('source');
// @ts-expect-error esclient mapping out-of-date
expect(packageTemplate.settings?.index?.mapping?.source).toEqual({ mode: 'synthetic' });
});

Expand Down Expand Up @@ -160,7 +159,6 @@ describe('EPM index template install', () => {
}

expect(packageTemplate.settings?.index?.mapping).toHaveProperty('source');
// @ts-expect-error esclient mapping out-of-date
expect(packageTemplate.settings?.index?.mapping?.source).toEqual({ mode: 'synthetic' });
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,6 @@ const updateExistingDataStream = async ({
const existingDsConfig = Object.values(existingDs);
const currentBackingIndexConfig = existingDsConfig.at(-1);
const currentIndexMode = currentBackingIndexConfig?.settings?.index?.mode;
// @ts-expect-error Property 'source.mode' does not exist on type 'IndicesMappingLimitSettings'
const currentSourceType = currentBackingIndexConfig?.settings?.index?.mapping?.source?.mode;

let settings: IndicesIndexSettings;
Expand Down Expand Up @@ -1148,7 +1147,6 @@ const updateExistingDataStream = async ({
// Trigger a rollover if the index mode or source type has changed
if (
currentIndexMode !== settings?.index?.mode ||
// @ts-expect-error Property 'source.mode' does not exist on type 'IndicesMappingLimitSettings'
currentSourceType !== settings?.index?.mapping?.source?.mode ||
dynamicDimensionMappingsChanged
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,16 @@ describe('updateDeprecatedComponentTemplates', () => {

expect(esClientMock.cluster.putComponentTemplate).toHaveBeenCalledTimes(1);
expect(esClientMock.cluster.putComponentTemplate).toHaveBeenCalledWith({
body: {
template: {
mappings: {
_source: {},
properties: {},
},
settings: {
index: {
mapping: {
source: {
mode: 'synthetic',
},
template: {
mappings: {
_source: {},
properties: {},
},
settings: {
index: {
mapping: {
source: {
mode: 'synthetic',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import pMap from 'p-map';
import type { ElasticsearchClient } from '@kbn/core/server';

import type { IndicesSourceMode } from '@elastic/elasticsearch/lib/api/types';

import { appContextService } from '..';

export async function updateDeprecatedComponentTemplates(esClient: ElasticsearchClient) {
Expand Down Expand Up @@ -37,27 +39,23 @@ export async function updateDeprecatedComponentTemplates(esClient: Elasticsearch
const settings = componentTemplate.component_template.template.settings;
await esClient.cluster.putComponentTemplate({
name: componentTemplate.name,
body: {
template: {
settings: {
...settings,
index: {
...settings?.index,
mapping: {
...settings?.index?.mapping,
// @ts-expect-error Property 'source' does not exist on type 'IndicesMappingLimitSettings'
source: {
// @ts-expect-error Property 'source.mode' does not exist on type 'IndicesMappingLimitSettings'
...settings?.index?.mapping?.source,
mode,
},
template: {
settings: {
...settings,
index: {
...settings?.index,
mapping: {
...settings?.index?.mapping,
source: {
...settings?.index?.mapping?.source,
mode: mode as IndicesSourceMode,
},
},
},
mappings: {
...componentTemplate.component_template.template.mappings,
_source: restOfSource,
},
},
mappings: {
...componentTemplate.component_template.template.mappings,
_source: restOfSource,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ export const registerSimulateRoute = ({
try {
const response = await clusterClient.asCurrentUser.ingest.simulate({
verbose,
body: {
pipeline,
docs: documents as estypes.IngestSimulateDocument[],
},
pipeline,
docs: documents as estypes.IngestDocument[],
});

return res.ok({ body: response });
Expand Down
12 changes: 6 additions & 6 deletions x-pack/platform/plugins/shared/ml/common/types/trained_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,18 @@ export interface StartTrainedModelDeploymentResponse {
export interface AllocatedModel {
key: string;
deployment_id: string;
allocation_status: {
allocation_status?: {
target_allocation_count: number;
state: string;
state?: string;
allocation_count: number;
};
number_of_allocations: number;
threads_per_allocation: number;
number_of_allocations?: number;
threads_per_allocation?: number;
/**
* Not required for rendering in the Model stats
*/
model_id?: string;
state: string;
state?: string;
reason?: string;
model_size_bytes: number;
required_native_memory_bytes: number;
Expand All @@ -205,7 +205,7 @@ export interface AllocatedModel {
average_inference_time_ms: number;
inference_count: number;
routing_state: {
routing_state: string;
routing_state?: string;
reason?: string;
};
last_access?: number;
Expand Down
4 changes: 2 additions & 2 deletions x-pack/platform/plugins/shared/ml/common/util/job_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ export function validateModelMemoryLimit(job: Job, limits: MlServerLimits): Vali
) {
if (typeof limits === 'object' && typeof limits.max_model_memory_limit !== 'undefined') {
const max = limits.max_model_memory_limit.toUpperCase();
const mml = job.analysis_limits.model_memory_limit.toUpperCase();
const mml = `${job.analysis_limits.model_memory_limit}`.toUpperCase();

// @ts-ignore
const mmlBytes = numeral(mml).value();
Expand All @@ -738,7 +738,7 @@ export function validateModelMemoryLimit(job: Job, limits: MlServerLimits): Vali
}

export function validateModelMemoryLimitUnits(
modelMemoryLimit: string | undefined
modelMemoryLimit: number | string | undefined
): ValidationResults {
const messages: ValidationResults['messages'] = [];
let valid = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
htmlIdGenerator,
} from '@elastic/eui';

import type { IngestSimulateDocument } from '@elastic/elasticsearch/lib/api/types';
import type { IngestDocument } from '@elastic/elasticsearch/lib/api/types';
import { extractErrorProperties } from '@kbn/ml-error-utils';

import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -90,7 +90,7 @@ export const TestPipeline: FC<Props> = memo(({ state, sourceIndex, mode }) => {
try {
const result = await mlApi.trainedModels.trainedModelPipelineSimulate(
pipelineConfig,
JSON.parse(sampleDocsString) as IngestSimulateDocument[]
JSON.parse(sampleDocsString) as IngestDocument[]
);
setSimulatePipelineResult(result);
} catch (error) {
Expand Down Expand Up @@ -124,7 +124,7 @@ export const TestPipeline: FC<Props> = memo(({ state, sourceIndex, mode }) => {

const getDocs = useCallback(
async (body: any) => {
let records: IngestSimulateDocument[] = [];
let records: IngestDocument[] = [];
let resp;
try {
resp = await mlApi.esSearch(body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export class JobCreator {
this._job_config.analysis_limits &&
this._job_config.analysis_limits.model_memory_limit !== undefined
) {
return this._job_config.analysis_limits.model_memory_limit;
return `${this._job_config.analysis_limits.model_memory_limit}`;
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,17 @@ export class DeploymentParamsMapper {
input: MlTrainedModelAssignmentTaskParametersAdaptive
): DeploymentParamsUI {
let optimized: DeploymentParamsUI['optimized'] = 'optimizedForIngest';
if (input.threads_per_allocation > 1) {
const threadsPerAllocation = input.threads_per_allocation ?? 0;
if (threadsPerAllocation > 1) {
optimized = 'optimizedForSearch';
}
const adaptiveResources = !!input.adaptive_allocations?.enabled;

const vCPUs =
input.threads_per_allocation *
threadsPerAllocation *
(adaptiveResources
? input.adaptive_allocations!.max_number_of_allocations!
: input.number_of_allocations);
: input.number_of_allocations ?? 0);

// The deployment can be created via API with a number of allocations that do not exactly match our vCPU ranges.
// In this case, we should find the closest vCPU range that does not exceed the max or static value of the range.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,11 @@ export const ExpandedRow: FC<ExpandedRowProps> = ({ item }) => {
}

return perDeploymentStat.nodes.map((n) => {
const nodeName = Object.values(n.node)[0].name;
const nodeName = Object.values(n.node ?? {})?.[0]?.name;
return {
key: `${perDeploymentStat.deployment_id}_${nodeName}`,
...perDeploymentStat,
...modelSizeStats,
// @ts-expect-error `throughput_last_minute` is not declared in ES Types
node: {
...pick(n, [
'average_inference_time_ms',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export abstract class InferenceBase<TInferResponse> {
}

protected async runPipelineSimulate(
processResponse: (d: estypes.IngestSimulateDocumentSimulation) => TInferResponse
processResponse: (d: estypes.IngestDocumentSimulation) => TInferResponse
): Promise<TInferResponse[]> {
try {
this.setRunning();
Expand Down Expand Up @@ -376,10 +376,10 @@ export abstract class InferenceBase<TInferResponse> {
};
}

protected getDocFromResponse({ doc, error }: estypes.IngestSimulatePipelineSimulation) {
protected getDocFromResponse({ doc, error }: estypes.IngestPipelineSimulation) {
if (doc === undefined) {
if (error) {
// @ts-expect-error Error is now typed in estypes. However, I doubt that it doesn't get the HTTP wrapper expected.
// @ts-expect-error Error is now typed in estypes. However, I doubt that it doesn't get the expected HTTP wrapper.
this.setFinishedWithErrors(error);
throw Error(error.reason);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('TrainedModelsService', () => {
let mockTelemetryService: jest.Mocked<ITelemetryClient>;
let mockDeploymentParamsMapper: jest.Mocked<DeploymentParamsMapper>;

const startModelAllocationResponseMock = {
const startModelAllocationResponseMock: StartTrainedModelDeploymentResponse = {
assignment: {
task_parameters: {
model_id: 'deploy-model',
Expand All @@ -47,6 +47,7 @@ describe('TrainedModelsService', () => {
deployment_id: 'my-deployment-id',
cache_size: '1mb',
},
// @ts-expect-error `node_count` not available in the types. Is it removed?
node_count: 1,
routing_table: {
'node-1': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,7 @@ export function trainedModelsApiProvider(httpService: HttpService) {
});
},

trainedModelPipelineSimulate(
pipeline: estypes.IngestPipeline,
docs: estypes.IngestSimulateDocument[]
) {
trainedModelPipelineSimulate(pipeline: estypes.IngestPipeline, docs: estypes.IngestDocument[]) {
const body = JSON.stringify({
pipeline,
docs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export function jobsHealthServiceProvider(
// match datafeed stats with the job ids
return (datafeedsStats as DatafeedStats[])
.map((datafeedStats) => {
const jobId = datafeedStats.timing_stats.job_id;
const jobId = datafeedStats.timing_stats?.job_id ?? 'unknown_job_id';
const jobState =
jobsStats.find((jobStats) => jobStats.job_id === jobId)?.state ?? 'failed';
return {
Expand Down
Loading

0 comments on commit e2e52c8

Please sign in to comment.