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

Incorrect TypeScript typings for function_score #2255

Open
arslivinski opened this issue May 9, 2024 · 4 comments
Open

Incorrect TypeScript typings for function_score #2255

arslivinski opened this issue May 9, 2024 · 4 comments

Comments

@arslivinski
Copy link

🐛 Bug Report

According to the documentation, I should be able to pass a random_score to a function_score. However, the TypeScript type appears to be wrong, not allowing this property.

Note that I'm using this package for the typings only.

To Reproduce

The following code

import type { estypes } from "@elastic/elasticsearch";

export const request: estypes.SearchRequest = {
  query: {
    function_score: {
      random_score: {
        seed: 10,
        field: "_seq_no",
      },
    },
  },
};

Results in this error

Object literal may only specify known properties, and 'random_score' does not exist in type 'QueryDslFunctionScoreQuery'.

Playground

Expected behavior

No error.

Your Environment

  • node version: 18.20.0
  • @elastic/elasticsearch version: >=8.12.2
  • os: Ubuntu 22.04.4
@JoshMock
Copy link
Member

Duplicate of elastic/elasticsearch-specification#2109, but I'll keep it open here so you get notified when that gets fixed. It's been sitting for a bit, but hopefully I can circle back to it soon. 🙃

@JoshMock
Copy link
Member

A fix has been provided in elastic/elasticsearch-specification#2833. Closing this, please follow that PR for updates.

@JoshMock
Copy link
Member

Reopening. I misread the description; that fix does not cover the exact issue here.

@JoshMock JoshMock reopened this Aug 29, 2024
@JoshMock
Copy link
Member

JoshMock commented Sep 3, 2024

A fix is in elastic/elasticsearch-specification#2852.

@JoshMock JoshMock self-assigned this Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants