[ES body removal] @elastic/kibana-management (#204871)

This commit is contained in:
Alejandro Fernández Haro 2025-01-10 21:58:18 +01:00 committed by GitHub
parent ec3013ccd1
commit 2687f4f109
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 31 additions and 37 deletions

View file

@ -10,7 +10,7 @@ import {
HealthStatus,
IndicesStatsIndexMetadataState,
Uuid,
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
} from '@elastic/elasticsearch/lib/api/types';
import type { ScopedHistory } from '@kbn/core-application-browser';
import type { SerializableRecord } from '@kbn/utility-types';
import type { LocatorPublic } from '@kbn/share-plugin/public';

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { schema, TypeOf } from '@kbn/config-schema';
import { SlmPolicyEs, PolicyIndicesResponse } from '../../../common/types';
@ -47,7 +46,7 @@ export function registerPolicyRoutes({
body: {
policies: Object.entries(policiesByName).map(([name, policy]) => {
// TODO: Figure out why our {@link SlmPolicyEs} is not compatible with:
// import type { SnapshotLifecyclePolicyMetadata } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
// import type { SnapshotLifecyclePolicyMetadata } from '@elastic/elasticsearch/lib/api/types';
return deserializePolicy(name, policy as SlmPolicyEs, managedPolicies);
}),
},
@ -119,9 +118,9 @@ export function registerPolicyRoutes({
try {
// Otherwise create new policy
const response = await clusterClient.asCurrentUser.slm.putLifecycle({
// TODO: bring {@link SlmPolicyEs['policy']} in line with {@link PutSnapshotLifecycleRequest}
...serializePolicy(policy),
policy_id: name,
// TODO: bring {@link SlmPolicyEs['policy']} in line with {@link PutSnapshotLifecycleRequest['body']}
body: serializePolicy(policy) as unknown as estypes.SlmPutLifecycleRequest['body'],
});
return res.ok({ body: response });
@ -149,9 +148,9 @@ export function registerPolicyRoutes({
// Otherwise update policy
const response = await clusterClient.asCurrentUser.slm.putLifecycle({
// TODO: bring {@link SlmPolicyEs['policy']} in line with {@link PutSnapshotLifecycleRequest}
...serializePolicy(policy),
policy_id: name,
// TODO: bring {@link SlmPolicyEs['policy']} in line with {@link PutSnapshotLifecycleRequest['body']}
body: serializePolicy(policy) as unknown as estypes.SlmPutLifecycleRequest['body'],
});
return res.ok({ body: response });

View file

@ -9,7 +9,7 @@ import { TypeOf } from '@kbn/config-schema';
import type {
SnapshotGetRepositoryResponse,
PluginStats,
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
} from '@elastic/elasticsearch/lib/api/types';
import {
ON_PREM_REPOSITORY_TYPES,

View file

@ -6,7 +6,6 @@
*/
import { schema, TypeOf } from '@kbn/config-schema';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { SnapshotRestore, SnapshotRestoreShardEs } from '../../../common/types';
import { serializeRestoreSettings } from '../../../common/lib';
@ -114,10 +113,10 @@ export function registerRestoreRoutes({
try {
const response = await clusterClient.asCurrentUser.snapshot.restore({
// TODO: Bring {@link RestoreSettingsEs} in line with {@link RestoreRequest}
...serializeRestoreSettings(restoreSettings),
repository,
snapshot,
// TODO: Bring {@link RestoreSettingsEs} in line with {@link RestoreRequest['body']}
body: serializeRestoreSettings(restoreSettings) as estypes.SnapshotRestoreRequest['body'],
});
return res.ok({ body: response });

View file

@ -6,7 +6,7 @@
*/
import { HealthReportImpact } from '@elastic/elasticsearch/lib/api/types';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import { SavedObject } from '@kbn/core/types';
export type DeprecationSource = 'Kibana' | 'Elasticsearch';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
export const diskIndicatorGreen: estypes.HealthReportDiskIndicator = {
status: 'green',

View file

@ -6,7 +6,7 @@
*/
import { i18n } from '@kbn/i18n';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import { IScopedClusterClient } from '@kbn/core/server';
import { EnrichedDeprecationInfo } from '../../../common/types';

View file

@ -7,7 +7,7 @@
import _ from 'lodash';
import { elasticsearchServiceMock } from '@kbn/core/server/mocks';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import fakeDeprecations from '../__fixtures__/fake_deprecations.json';
import * as healthIndicatorsMock from '../__fixtures__/health_indicators';

View file

@ -8,7 +8,7 @@
import type {
MigrationDeprecationsResponse,
MigrationDeprecationsDeprecation,
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
} from '@elastic/elasticsearch/lib/api/types';
import { IScopedClusterClient } from '@kbn/core-elasticsearch-server';
import _ from 'lodash';
import { EnrichedDeprecationInfo } from '../../../common/types';

View file

@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
interface Mapping {
type?: string;

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import type { ClusterGetSettingsResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { ClusterGetSettingsResponse } from '@elastic/elasticsearch/lib/api/types';
import { ByteSizeValue } from '@kbn/config-schema';
import { API_BASE_PATH } from '../../common/constants';
import { versionCheckHandlerWrapper } from '../lib/es_version_precheck';

View file

@ -6,7 +6,7 @@
*/
import type { Moment } from 'moment';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import { ACTION_STATES, WATCH_STATES, WATCH_STATE_COMMENTS } from '../constants';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import { IScopedClusterClient } from '@kbn/core/server';
import { get } from 'lodash';
import { ES_SCROLL_SETTINGS } from '../../../common/constants';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import { schema } from '@kbn/config-schema';
import { IScopedClusterClient } from '@kbn/core/server';
import { reduce, size } from 'lodash';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import { schema } from '@kbn/config-schema';
import { IScopedClusterClient } from '@kbn/core/server';
import { RouteDependencies } from '../../../types';

View file

@ -8,7 +8,7 @@
import { v4 as uuidv4 } from 'uuid';
import { cloneDeep } from 'lodash';
import { InferenceServiceSettings } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { InferenceServiceSettings } from '@elastic/elasticsearch/lib/api/types';
import { LocalInferenceServiceSettings } from '@kbn/ml-trained-models-utils/src/constants/trained_models';
import {
ChildFieldName,

View file

@ -9,7 +9,7 @@ import { METRIC_TYPE } from '@kbn/analytics';
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';
import { IndicesStatsResponse } from '@elastic/elasticsearch/lib/api/types';
import { InferenceAPIConfigResponse } from '@kbn/ml-trained-models-utils';
import { MappingTypeMapping } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { MappingTypeMapping } from '@elastic/elasticsearch/lib/api/types';
import {
API_BASE_PATH,
INTERNAL_API_BASE_PATH,

View file

@ -6,7 +6,7 @@
*/
import { schema } from '@kbn/config-schema';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import { RouteDependencies } from '../../../types';
import { addBasePath } from '..';

View file

@ -9,7 +9,7 @@ import { forEach, keys, sortBy, reduce, size } from 'lodash';
import { flatMap, flow, groupBy, values as valuesFP, map, pickBy } from 'lodash/fp';
import type { IScopedClusterClient } from '@kbn/core/server';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import type { FieldCapsResponse } from '@elastic/elasticsearch/lib/api/types';
export type FieldCapsList = FieldCapsResponse['fields'];

View file

@ -6,7 +6,7 @@
*/
import { schema } from '@kbn/config-schema';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import { RouteDependencies } from '../../../types';
import { addBasePath } from '..';

View file

@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import { schema, TypeOf } from '@kbn/config-schema';
import { RouteDependencies } from '../../../types';
@ -40,15 +40,11 @@ export function registerSimulateRoute({ router, lib: { handleEsError } }: RouteD
const params: estypes.IndicesSimulateTemplateRequest = templateName
? {
name: templateName,
body: {
index_patterns,
},
index_patterns,
}
: {
body: {
...template,
index_patterns,
},
...template,
index_patterns,
};
try {

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import { Pipeline, Processor } from '../types';
export function deserializePipelines(pipelinesByName: {

View file

@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import { schema } from '@kbn/config-schema';
import { API_BASE_PATH } from '../../../common/constants';