class VitamElasticsearchRepository implements VitamRepository {

    @Override
    public void remove(String id, Integer tenant) throws DatabaseException {
        ParametersChecker.checkParameter(ALL_PARAMS_REQUIRED, id);

        String index = indexName;
        if (indexByTenant) {
            index = index + "_" + tenant;
        }

        DeleteRequest request = new DeleteRequest(index)
            .id(id)
            .timeout(TimeValue.timeValueMillis(VitamConfiguration.getElasticSearchTimeoutWaitRequestInMilliseconds()))
            .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
        DeleteResponse deleteResponse;
        try {
            deleteResponse = client.delete(request, RequestOptions.DEFAULT);
        } catch (IOException | ElasticsearchException e) {
            if (e instanceof ElasticsearchException &&
                ((ElasticsearchException) e).status() == RestStatus.NOT_FOUND) {
                //Nothing to do
                return;
            }

            throw new DatabaseException(e);
        }


        DocWriteResponse.Result result = deleteResponse.getResult();
        switch (result) {
            case DELETED:
            case NOT_FOUND:
                break;
            default:
                handleFailures(deleteResponse);
        }

    }

    public  VitamElasticsearchRepository(RestHighLevelClient client, String indexName, boolean indexByTenant);

}