Skip to content

Bulk delete API is not respecting the index in the current request #8001

@bonny-bonev

Description

@bonny-bonev

Elastic.Clients.Elasticsearch version: 8.11

Elasticsearch version:8.11

.NET runtime version:4.8

Operating system version:Win 11

Description of the problem including expected versus actual behavior:
When using the bulk API for delete, the index is not respected.
Example:
var request = new BulkRequest(indexName) { Refresh = Refresh.True };
foreach (var document in documents)
{
request.Operations.Add(new BulkDeleteOperation<SearchModel.Document>(document.IdentityField.Value.ToString()));
}
this.elasticClient.Bulk(request); // Results in error that there is no default index. The "indexName" is not used for some reason.
this.elasticClient.Bulk(b => b.Index(indexName).DeleteMany(documents)); // Same error. Even tough I am setting the "indexName", it is not respected.

For context, this works as expected for single document:
this.elasticClient.Delete(new DeleteRequest(indexName, documents.First().IdentityField.Value.ToString()));

Steps to reproduce:

  1. Create Elasticsearch client with valid connection
  2. Call the bulk delete API

Expected behavior
The documents are deleted from the passed index and no error is thrown

Provide ConnectionSettings (if relevant):

Provide DebugInformation (if relevant):

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions