Closed
Description
🐛 Bug Report
According to the documentation, to revert an index setting to the default value we should set its value to null
.
To Reproduce
There is no runtime error using null
, running the following code:
import { Client } from "@elastic/elasticsearch";
let client = new Client({...});
client.indices.putSettings({
index: "...",
settings: {
refresh_interval: null
}
}).then(console.log)
It prints { acknowledged: true }
and it removes refresh_interval
setting if it was set to something. However, according to the IDE and the typescript compiler this is an error:
src/util/example.ts:8:9 - error TS2769: No overload matches this call.
Overload 1 of 3, '(this: That, params: import(".../node_modules/@elastic/elasticsearch/lib/api/types").IndicesPutSettingsRequest | import(".../node_modules/@elastic/elasticsearch/lib/api/typesWithBodyKey").IndicesPutSettingsRequest, options?: TransportRequestOptionsWithOutMeta | undefined): Promise<...>', gave the following error.
Type 'null' is not assignable to type 'Duration | undefined'.
Overload 2 of 3, '(this: That, params: import(".../node_modules/@elastic/elasticsearch/lib/api/types").IndicesPutSettingsRequest | import(".../node_modules/@elastic/elasticsearch/lib/api/typesWithBodyKey").IndicesPutSettingsRequest, options?: TransportRequestOptionsWithMeta | undefined): Promise<...>', gave the following error.
Type 'null' is not assignable to type 'Duration | undefined'.
Overload 3 of 3, '(this: That, params: import(".../node_modules/@elastic/elasticsearch/lib/api/types").IndicesPutSettingsRequest | import(".../node_modules/@elastic/elasticsearch/lib/api/typesWithBodyKey").IndicesPutSettingsRequest, options?: TransportRequestOptions | undefined): Promise<...>', gave the following error.
Type 'null' is not assignable to type 'Duration | undefined'.
8 refresh_interval: null
Expected behavior
No typescript or IDE errors when setting any setting to null
.
Your Environment
- node version: v20.5.1
@elastic/elasticsearch
version: 8.9.0- os: Mac