Conversation
…sts/actions.test.ts
FrankHassanabad
left a comment
There was a problem hiding this comment.
LGTM,
- Looked through the
security_solutioncode, saw most was repeating patterns for the upgrade. - Took two notes of an areas that looked more involved, dug a bit deeper but those areas look ok to me 👍
patrykkopycinski
left a comment
There was a problem hiding this comment.
Asset management LGTM
weltenwort
left a comment
There was a problem hiding this comment.
infra plugin changes LGTM. We'll do some cleanup separately. Thank you!
matschaffer
left a comment
There was a problem hiding this comment.
Approving for @elastic/metrics-ui and @elastic/stack-monitoring-ui
…issue-108387-es-client-80
…egistered by home
💛 Build succeeded, but was flaky
Test Failures
Metrics [docs]Public APIs missing comments
Async chunks
Public APIs missing exports
Unknown metric groupsAPI count
History
To update your PR or re-run it, just comment with: |
Summary
Migrates Kibana to next major version of the
@elastic/elasticsearchclientcloses #108387
The full list of changes is here
Some most noticeable changes:
The returned value of API calls is the body and not the HTTP related keys.
It's the biggest source of changes in the current PR. From
v8.0, the Client will returnbodyby default. If you needstatusCodeandheader, you need to providemeta: trueflag toTransportRequestOptionsSince this change affected literally every method call in the entire repository, we decided that the service provided from Core would default to this
meta: trueflag of of the box.This creates a difference in the
import type { Client } from '@elastic/elasticsearch'andimport type { ElasticsearchClient } from 'src.core.serverclient interfaces, so I've created #116095 to resolve these differences.Your plugin code doesn't need to set this flag manually.
The code in your functional tests can set the flag. it depends on whether you need meta-information about the request results.
Types for the mode with
meta: trueshould be imported from@elastic/elasticsearch/lib/api/typesWithBodyKey.Drop support for old camelCased keys
Some interfaces have been removed in #115528, some in the current PR.
Remove the current abort API and use the new Abort API
Code in
dataandAPMplugins is refactored.bodykey inrequestis derecated.Codeowner should inline body keys instead. We will define an explicit deadline to remove the
bodykey from requests.Some request keys have been renamed
Use type definitions as the reference.
Product check performed on every response
Notes for teams
createEsClientinferred type, I kindly ask you to fix it in a follow-up@ts-ignoresince type check fails locally and on CI unpredictablySkipped tests
x-pack/test/search_sessions_integration/tests/apps/discover/async_search.tskibana/x-pack/test/search_sessions_integration/tests/apps/discover/async_search.ts
Lines 105 to 108 in 0a615cb
Performance
DemoJourney test shows "global" response time reduced by 30%The performance will be improved when we switch to the new http client (undici). The HTTP client migration will be done in a separate task #116087
Known problems with Kibana
KibanaClientbecause KibanaClient enforcesmeta:truekibana still relies on removedindices.freezefunctionalityList of known client problems
bodyis rewritten by any parameter https://github.com/elastic/elasticsearch-js/blob/main/src/api/api/create.ts#L56-L59 probably another API is broken too'node-abort-controller'doesn't contain typingsundiciusesbufferAPI introduced in nodejs v15.@elastic/transporttypings, I had to add@elastic/transportto the Kibana depsClientis not compatible withKibanaClient('dataFrameTransformDeprecated' is missing in type 'Client')statusCode,bodyandheadersare optional inDiagnosticResultClient usesSymbolto declare API. It breaks mocks in Kibanasignal: AbortSignalinstead. See examples https://www.npmjs.com/package/node-abort-controller https://www.npmjs.com/package/node-fetch#request-cancellation-with-abortsignal{ [key:string]: never }: MappingFieldMapping, IndicesUpdateAliasesIndicesUpdateAliasBulk, IlmAction, Transform, AggregationsBucketsPath, SpecUtilsAdditionalProperties, SpecUtilsAdditionalProperty, SpecUtilsOverloadOf, SearchAggregationProfileDebug, AggregationsPercentageScoreHeuristic, QueryDslRankFeatureFunction, QueryDslRankFeatureFunctionLinear, WatcherAlwaysCondition, WatcherNeverConditionstringinstead.Contextshould falls back tounknownby deafult. Otherwise we have to explicitly declaretype My = TransportResult<ResponseType, unknown>instead oftype My = TransportResult<ResponseType>. It affectsDiagnosticResultas well.SearchHitsMetadata.totalshould it beSearchTotalHits? AFAIKnumberis deprecatedenumfor events. It's better to use a method overload instead of importingenum.client.diagnostic.on(events.RESPONS-->client.diagnostic.on('response')keepAliveandmaxSocketsoptionsRequestBodyand others aren't exported from@elastic/transport/lib/typesBulkResponseItemBase.error: ErrorCause | string;,MgetHit.error: ErrorCause | string;,ShardFailure.reason: ErrorCause | string;and lots of others break a lot of code since it doesn't expectstring@elastic/transportdirectlyilm.putLifecycle({ policy, body })fails with ES errorResponseError: x_content_parse_exception: [x_content_parse_exception] Reason: [1:11] [put_lifecycle_request] policy doesn't support values of type: VALUE_STRINGbutilm.putLifecycle({ body })fails with ES client errorTypeError: Cannot read property 'toString' of undefined at Ilm.putLifecycle (/@elastic/elasticsearch/src/api/api/ilm.ts:245:67)bodyhttps://github.com/elastic/elasticsearch-js/blob/main/src/api/api/transform.ts#L228scroll({body: { scroll_id:.. } })fails intil move body to params:scroll({ scroll_id:.. })indices.freezemethodcomptible-with=8toacceptheader, but notcontent-typeml.startDatafeedrequest do not recognizestartConnectionError: path must be an absolute URL or start with a slashsortparam is always sent in the body. ThefieldName:sortOrdersyntax can no longer be used (e.gsort: 'create_at:desc')packages/kbn-apm-config-loader/src/init_apm.tspackages/kbn-apm-config-loader/src/init_apm.test.tsx-pack/test/performance/tests/reporting_dashboard.tsRisk Matrix
Plugin API changes
Elasticsearch service provides the new version of the
elasticsearch-jslibrary. You can find the full list of changes, including breaking ones, here.