Skip to content

Incorrect TypeScript typings for function_score #2255

@arslivinski

Description

@arslivinski

🐛 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions