I am new to elastic search. I am using elastic search version 7.4.0. I am able to create and update record in elastic search by using @elastic/elasticsearch npm package. I am using node js with typescript. When I am trying to delete record from elastic search it is giving me "Response Error". I am not getting what is wrong here. Below is my code.
import { Client, ApiResponse, RequestParams } from "@elastic/elasticsearch";
export class ElasticSearchService {
public async deleteIndex (index: string, id: string): Promise<any> {
return new Promise<any>(async (resolve: any, reject: any) => {
try {
const doc1: RequestParams.Delete = {
index: index,
id: id
};
let result: ApiResponse = await client.delete(doc1);
resolve(result);
} catch (e) {
reject(e);
}
});
}
}