Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] <title> SortCombinations typings lacking interfaces/types #850

Closed
logan858 opened this issue Aug 21, 2024 · 3 comments
Closed

[BUG] <title> SortCombinations typings lacking interfaces/types #850

logan858 opened this issue Aug 21, 2024 · 3 comments

Comments

@logan858
Copy link

Describe the bug

I have a project where I'm converting from elasticsearch to opensearch, on a node/express server. (npm v @opensearch-project/opensearch@3.0.0-beta.3 )

I am noticing some (potential?) issues with the typings in this package, specifically the sort:
image
sortQuery:
image
image

my sortQuery func needs to return a SortCombinations compliant type object. In elasticsearch, the SortCombinations accomodates sorting by the field name with the SortOptions type like so:
es typings:
image

BUT, when we see the similar sort typings in os, it lacks the SortOptions of [property: string]: FieldSort | SortOrder | etc, etc. which allows the correct typings to be recognized for sorting by field names.
image

When using my own 'incorrectly' typed code it works perfectly fine to sort the opensearch results despite what the typings show , and in the opensearch docs it shows the functionality as one would expect:
image

Related component

Search

To Reproduce

  1. Build an opensearch search query in ts/js.
  2. and a sort object to the body
  3. see typings mismatch

Expected behavior

typings should include field name sorting.

Additional Details

No response

@logan858
Copy link
Author

logan858 commented Aug 21, 2024

my temporary local fix:
image
image
image

edit: (minus the format field, that doesnt seem to be supported by opensearch)

@nhtruong
Copy link
Collaborator

Thank you for bringing this to our attention. This incomplete typing for sort comes from the spec, which 3.x API is generated from. I've created an issue for it.

@nhtruong
Copy link
Collaborator

Closing as the spec has been updated and we're releasing beta.7 that includes the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants