Delete function not working since update 8.0

In our React project, we use the npm package "@elastic/elasticsearch".

Since 8.0 migration, delete function is not working. We implement it this way:

// 1) Declaration of client instance

import { Client } from '@elastic/elasticsearch';
import Config from 'src/config';

const client = new Client(Config.get('/authentication/elastic'));

export default client;
// 2) Use delete fonction

public async delete(id: string): Promise<any> {
    try {
      return await this.client.delete({
        index: this.indexName,
        id: id,
    } catch (e) {
      return null;

The promise does not return an error, it sends this:

  _index: 'visitor_0',
  _id: 'RN-PdzFW-Yfr0ahMp',
  _version: 3,
  result: 'deleted',
  _shards: { total: 2, successful: 1, failed: 0 },
  _seq_no: 396,
  _primary_term: 22

Problem, it does not delete the object. It updates it with empty content.

I try do delete manually on elastic dashboard, it works correctly. I try do a small script by entering the id by hand, it also works.

// my small script
'use strict';


const util = require('util');

const elastic = require('./services/elastic/client').default;

const debug = o => console.log(util.inspect(o, false, null, true));

(async () => {
  const id = 'ChmG-wAL-YpjZAdGp';

  try {
    const result = await elastic.delete({ index: 'visitor', id });
  } catch (e) {

Do any of you have any idea where my problem could come from?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.