'Elasticsearch Node.js delete does not work

I have the following function to remove document from index:

async deleteDocument (indexName: string, id: string) {
    const indexExist = await this.isIndexExists(indexName)

    if (indexExist) {
      return this.client.delete({ index: indexName, id })
    }

    return Promise.resolve()
}

When I console.log() the response from this function it returns elastic response saying that deletion was successful. However, when I check in Kibana, the deleted document is still in place even after a few hours of waiting.

I tried to use refresh set to true and wait_for, but that seems to have no effect on a result as well.

What could be wrong with the function and how can I fix it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source