Skip to content

Commit

Permalink
Update @elastic/elasticsearch to v8.2.0-canary.2 (#128633) (#129287)
Browse files Browse the repository at this point in the history
* 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 158c617)

Co-authored-by: Pierre Gayvallet <pierre.gayvallet@elastic.co>
  • Loading branch information
kibanamachine and pgayvallet authored Apr 4, 2022
1 parent 2aa076a commit 9a02be4
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
};
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions src/core/server/saved_objects/mappings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2366,6 +2366,7 @@ export interface SavedObjectsExportTransformContext {
// @public
export type SavedObjectsFieldMapping = estypes.MappingProperty & {
dynamic?: false | 'strict';
properties?: Record<estypes.PropertyName, estypes.MappingProperty>;
};

// @public (undocumented)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 9a02be4

Please sign in to comment.