Skip to content

Conversation

@pquentin
Copy link
Member

@pquentin pquentin commented Sep 1, 2025

elastic/elasticsearch-specification#1144 was opened in 2021 and just merged last week. It turns out that Elasticsearch search endpoint always returns response.hits.hits._score and response.hit.max_score, so they are now required. It causes failures in Kibana type checks. This affects a lot of tests that have mock search responses.

Since _score and max_score are already allowed today, the goal of this PR is to add them to the relevant tests so that making them actually required is less tedious.

For example, an issue that I don't know how to fix is:

proc [tsc] x-pack/packages/ai-infra/product-doc-artifact-builder/src/tasks/extract_documentation.ts:103:33 - error TS2345: Argument of type '(hit: SearchHit<any>) => ExtractedDocument' is not assignable to parameter of type '(value: SearchHit<unknown>, index: number, array: SearchHit<unknown>[]) => ExtractedDocument'.
proc [tsc]   Types of parameters 'hit' and 'value' are incompatible.
proc [tsc]     Type 'SearchHit<unknown>' is not assignable to type 'SearchHit<any>'.
proc [tsc]       Types of property '_score' are incompatible.
proc [tsc]         Type 'number \| null \| undefined' is not assignable to type 'number \| null'.
proc [tsc]           Type 'undefined' is not assignable to type 'number \| null'.
proc [tsc]
proc [tsc] 103   return response.hits.hits.map(convertHit);

The affected lines:

const convertHit = (hit: SearchHit<any>): ExtractedDocument => {
const source = hit._source;
return {
content_title: source.content_title,
content_body: source.content_body,
product_name: getProductNameFromSource(source.product_name),
root_type: 'documentation',
slug: source.slug,
url: source.url,
version: source.version,
ai_subtitle: source.ai_fields.ai_subtitle,
ai_summary: source.ai_fields.ai_summary,
ai_questions_answered: source.ai_fields.ai_questions_answered,
ai_tags: source.ai_fields.ai_tags,
};
};

I tried using unknown instead of any, but then all accesses to source fail.

@pquentin pquentin requested a review from a team as a code owner September 1, 2025 13:32
@pquentin pquentin added the release_note:skip Skip the PR/issue when compiling release notes label Sep 1, 2025
@pquentin pquentin requested review from a team as code owners September 2, 2025 09:55
@botelastic botelastic bot added Team:Fleet Team label for Observability Data Collection Fleet team Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. labels Sep 2, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@pquentin
Copy link
Member Author

pquentin commented Sep 2, 2025

I discussed with the @elastic/devtools-team team that this is just too much work for Kibana. We're going to revert the PR in the specification. After all, we have lived without those required changes for years now.

@elasticmachine
Copy link
Contributor

elasticmachine commented Sep 2, 2025

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #9 / aggregateEventsBySavedObject should call cluster with correct options
  • [job] [logs] Jest Tests #9 / aggregateEventsBySavedObject should call cluster with correct options
  • [job] [logs] Jest Tests #9 / aggregateEventsWithAuthFilter should call cluster with correct options
  • [job] [logs] Jest Tests #9 / aggregateEventsWithAuthFilter should call cluster with correct options
  • [job] [logs] Jest Tests #9 / aggregateEventsWithAuthFilter should call cluster with correct options when includeSpaceAgnostic is true
  • [job] [logs] Jest Tests #9 / aggregateEventsWithAuthFilter should call cluster with correct options when includeSpaceAgnostic is true
  • [job] [logs] Jest Tests #1 / CsvGenerator fields from job.columns (7.13+ generated) default column names come from tabify
  • [job] [logs] Jest Tests #1 / CsvGenerator fields from job.columns (7.13+ generated) default column names come from tabify
  • [job] [logs] Jest Tests #1 / CsvGenerator fields from job.searchSource.getFields() (7.12 generated) sorts the fields when they are to be used as table column names
  • [job] [logs] Jest Tests #1 / CsvGenerator fields from job.searchSource.getFields() (7.12 generated) sorts the fields when they are to be used as table column names
  • [job] [logs] Jest Tests #14 / EntityStoreDataClient search entities returns inspect query params
  • [job] [logs] Jest Tests #14 / EntityStoreDataClient search entities returns inspect query params
  • [job] [logs] FTR Configs #29 / EQL execution logic API @ess @serverless Alert Suppression for EQL rules @skipInServerless sequence queries with suppression duration does not suppress alerts outside of duration
  • [job] [logs] Jest Tests #12 / files service #getFilesByStatus() should return expected values
  • [job] [logs] Jest Tests #12 / files service #getFilesByStatus() should return expected values
  • [job] [logs] Jest Tests #14 / formatHit formats a document as expected
  • [job] [logs] Jest Tests #14 / formatHit formats a document as expected
  • [job] [logs] Jest Tests #14 / formatHit should filter fields based on their real name not displayName
  • [job] [logs] Jest Tests #14 / formatHit should filter fields based on their real name not displayName
  • [job] [logs] Jest Tests #14 / formatHit should highlight a subfield even shouldShowFieldHandler determines it should not be shown
  • [job] [logs] Jest Tests #14 / formatHit should highlight a subfield even shouldShowFieldHandler determines it should not be shown
  • [job] [logs] Jest Tests #14 / formatHit should not include fields not mentioned in fieldsToShow
  • [job] [logs] Jest Tests #14 / formatHit should not include fields not mentioned in fieldsToShow
  • [job] [logs] Jest Tests #14 / partitionMissingFieldsEvents should partition if one field is empty
  • [job] [logs] Jest Tests #14 / partitionMissingFieldsEvents should partition if one field is empty
  • [job] [logs] Jest Tests #14 / utils deconflictSignalsAndResults given a duplicate in querySignals it returns both combined together without the duplicate
  • [job] [logs] Jest Tests #14 / utils deconflictSignalsAndResults given a duplicate in querySignals it returns both combined together without the duplicate
  • [job] [logs] Jest Tests #14 / utils deconflictSignalsAndResults given a duplicate in signals it returns both combined together without the duplicate
  • [job] [logs] Jest Tests #14 / utils deconflictSignalsAndResults given a duplicate in signals it returns both combined together without the duplicate
  • [job] [logs] Jest Tests #14 / utils deconflictSignalsAndResults it logs a debug statement when it sees a duplicate and returns nothing if both are identical
  • [job] [logs] Jest Tests #14 / utils deconflictSignalsAndResults it logs a debug statement when it sees a duplicate and returns nothing if both are identical
  • [job] [logs] Jest Tests #14 / wrapSuppressedAlerts should wrap event with alert fields and correctly set suppression fields
  • [job] [logs] Jest Tests #14 / wrapSuppressedAlerts should wrap event with alert fields and correctly set suppression fields

Metrics [docs]

✅ unchanged

History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:skip Skip the PR/issue when compiling release notes Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. Team:Fleet Team label for Observability Data Collection Fleet team Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants