Update @elastic/elasticsearch to v8.2.0-canary.2 (#128633) (#129287)

* Update @elastic/elasticsearch to v8.2.0-canary.2

* fix core violation

* add optional properties to our type

* update generated doc

* add another ts-ignore

* remove unused ts-expect-error

* add ts-expect-error for type typo

* add ts-expect-error infra code

* fix more errors

(cherry picked from commit 158c6170ae)

Co-authored-by: Pierre Gayvallet <pierre.gayvallet@elastic.co>
This commit is contained in:
Kibana Machine 2022-04-04 05:36:14 -04:00 committed by GitHub
parent 2aa076a33a
commit 9a02be474a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 16 additions and 8 deletions

View file

@ -13,5 +13,6 @@ Please refer to [elasticsearch documentation](https://www.elastic.co/guide/en/el
```typescript
export declare type SavedObjectsFieldMapping = estypes.MappingProperty & {
dynamic?: false | 'strict';
properties?: Record<estypes.PropertyName, estypes.MappingProperty>;
};
```

View file

@ -106,7 +106,7 @@
"@elastic/apm-synthtrace": "link:bazel-bin/packages/elastic-apm-synthtrace",
"@elastic/charts": "45.1.1",
"@elastic/datemath": "link:bazel-bin/packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.2.0-canary.1",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.2.0-canary.2",
"@elastic/ems-client": "8.2.0",
"@elastic/eui": "53.0.1",
"@elastic/filesaver": "1.1.2",

View file

@ -107,6 +107,11 @@ export type SavedObjectsFieldMapping = estypes.MappingProperty & {
* *never* use `dynamic: true`.
*/
dynamic?: false | 'strict';
/**
* Some mapping types do not accept the `properties` attributes. Explicitly adding it as optional to our type
* to avoid type failures on all code using accessing them via `SavedObjectsFieldMapping.properties`.
*/
properties?: Record<estypes.PropertyName, estypes.MappingProperty>;
};
/** @internal */

View file

@ -2366,6 +2366,7 @@ export interface SavedObjectsExportTransformContext {
// @public
export type SavedObjectsFieldMapping = estypes.MappingProperty & {
dynamic?: false | 'strict';
properties?: Record<estypes.PropertyName, estypes.MappingProperty>;
};
// @public (undocumented)

View file

@ -228,6 +228,7 @@ export async function getDataTelemetry(esClient: ElasticsearchClient) {
const indices = indexNames.map((name) => {
const baseIndexInfo = {
name,
// @ts-expect-error 'properties' does not exist on type 'MappingMatchOnlyTextProperty'
isECS: !!indexMappings[name]?.mappings?.properties?.ecs?.properties?.version?.type,
shipper: indexMappings[name]?.mappings?._meta?.beat,
packageName: indexMappings[name]?.mappings?._meta?.package?.name,

View file

@ -23,7 +23,6 @@ export const fetchIndices = async (client: IScopedClusterClient): Promise<Elasti
// node.js string length limit: https://github.com/nodejs/node/issues/33960
filter_path: ['*.aliases'],
// for better performance only compute aliases and settings of indices but not mappings
// @ts-expect-error new param https://github.com/elastic/elasticsearch-specification/issues/1382
features: ['aliases', 'settings'],
});

View file

@ -31,7 +31,6 @@ async function fetchIndicesCall(
'*.data_stream',
],
// for better performance only compute aliases and settings of indices but not mappings
// @ts-expect-error new param https://github.com/elastic/elasticsearch-specification/issues/1382
features: ['aliases', 'settings'],
});

View file

@ -169,6 +169,7 @@ export class KibanaFramework {
} as estypes.MsearchRequest);
break;
case 'fieldCaps':
// @ts-expect-error FieldCapsRequest.fields is not optional, CallWithRequestParams.fields is
apiResult = elasticsearch.client.asCurrentUser.fieldCaps({
...params,
});

View file

@ -112,6 +112,7 @@ export function modelsProvider(client: IScopedClusterClient, mlClient: MlClient)
*/
async getNodesOverview(): Promise<NodesOverviewResponse> {
// TODO set node_id to ml:true when elasticsearch client is updated.
// @ts-expect-error typo in type definition: MlGetMemoryStatsResponse.cluser_name
const response = (await mlClient.getMemoryStats()) as MemoryStatsResponse;
const { trained_model_stats: trainedModelStats } = await mlClient.getTrainedModelsStats({

View file

@ -37,8 +37,8 @@ export const createMigrationIndex = async ({
body: {
settings: {
index: {
// @ts-expect-error `name` is required on IndicesIndexSettingsLifecycle
lifecycle: {
// @ts-expect-error typings don't contain the property yet
indexing_complete: true,
},
},

View file

@ -1485,10 +1485,10 @@
dependencies:
"@elastic/ecs-helpers" "^1.1.0"
"@elastic/elasticsearch@npm:@elastic/elasticsearch-canary@8.2.0-canary.1":
version "8.2.0-canary.1"
resolved "https://registry.yarnpkg.com/@elastic/elasticsearch-canary/-/elasticsearch-canary-8.2.0-canary.1.tgz#da547aaf0a39846cda4484bc021dea2117acaf0c"
integrity sha512-MxDCQjcKgxQulX+PJiPWdwFJwYq5J1EVycU5EaE1sDODLnnJp5dvQFPtRRla9MM5Elyy52swtfzQA5ktGixyRg==
"@elastic/elasticsearch@npm:@elastic/elasticsearch-canary@8.2.0-canary.2":
version "8.2.0-canary.2"
resolved "https://registry.yarnpkg.com/@elastic/elasticsearch-canary/-/elasticsearch-canary-8.2.0-canary.2.tgz#2513926cdbfe7c070e1fa6926f7829171b27cdba"
integrity sha512-Ki2lQ3/UlOnBaf5EjNw0WmCdXiW+J020aYtdVnIuCNhPSLoNPKoM7P+MlggdfeRnENvINlStrMy4bkYF/h6Vbw==
dependencies:
"@elastic/transport" "^8.0.2"
tslib "^2.3.0"