Skip to content

Support sort in ExtendedSearchUsage#5868

Merged
pquentin merged 7 commits into
mainfrom
extended-search-usage-sort
Jan 14, 2026
Merged

Support sort in ExtendedSearchUsage#5868
pquentin merged 7 commits into
mainfrom
extended-search-usage-sort

Conversation

@pquentin
Copy link
Copy Markdown
Member

Added by @davidkyle in elastic/elasticsearch#139530. I initially wanted to do this instead:

export enum SortType {
  _doc,
  _geo_distance,
  _score,
  _script,
  field_sort,
}

sort?: Dictionary<SortType, long>

However, typescript-generator converts that to a Record which expects all keys to be present:

case 'dictionary_of': {
const result = `Record<${buildValue(type.key, openGenerics)}, ${buildValue(type.value, openGenerics)}>`
return type.singleKey ? `Partial<${result}>` : result
}

Interestingly, SingleKeyDictionary uses Partial which makes validation pass, but that's wrong. Since search usage is highly dynamic instead, I've opted for string.

@pquentin pquentin added the skip-backport This pull request should not be backported label Dec 19, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 19, 2025

Following you can find the validation changes against the target branch for the API.

API Status Request Response
cluster.stats 🔴 → 🟢 27/27 0/27 → 27/27

You can validate this API yourself by using the make validate target.

Copy link
Copy Markdown
Member

@davidkyle davidkyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks @pquentin I didn't think to update the spec for my change

@flobernd
Copy link
Copy Markdown
Member

However, typescript-generator converts that to a Record which expects all keys to be present:

Mhh, I wonder if this is intended and if we should really prefer string vs. a proper enum just because of that technical constraint?

@pquentin pquentin requested a review from a team as a code owner January 13, 2026 12:48
@pquentin pquentin merged commit 171aef7 into main Jan 14, 2026
11 checks passed
@pquentin pquentin deleted the extended-search-usage-sort branch January 14, 2026 12:30
gmjehovich pushed a commit that referenced this pull request Apr 13, 2026
* Support sort in ExtendedSearchUsage

* Switch to enum key

* typescript-generator: fix lint

* Remove all output changes to test automation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

generator:typescript skip-backport This pull request should not be backported specification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants