ElasticClient.DeleteByQueryAsync method is not waiting as per given Timeout

I am using Nest version 7.11.1. I am trying to use DeleteByQueryAsync method of ElasticClient. Below is the code I am trying to make working.

var settings = await GetConnectionSettings("XYZTenant"); //// This method sets the setting.
/*
I don't want to use below setting as it will set timeout for all my future request. As I am using the caching and returning same ElasticClient instance when needed in future.

settings.RequestTimeout(new TimeSpan(0, 10, 0)); 
*/
ElasticClient client = new ElasticClient(settings);

await client.DeleteByQueryAsync<object>(dd => dd
                    .Index(Indices.Index(indexAliases))                    
                    .Query(qd => qd.MatchAll())
                    .Conflicts(Conflicts.Proceed)                    
                    .WaitForCompletion()                    
                    .Refresh()
                    .Timeout(new Time(new TimeSpan(0, 7, 0)))
                );

But it's getting timeout after 60 second as I have around 2 million record to delete.
So it is not waiting for 7 minute what I configured.
I am not sure what I am missing. Could anyone please help me here?
Thanks in advance.

I found a method RequestConfiguration where we can set the RequestTimeout for individual request and that worked for me.

await client.DeleteByQueryAsync<object>(dd => dd
                    .Index(Indices.Index(indexAliases))
                    .RequestConfiguration(x => x.RequestTimeout(new TimeSpan(0, 10, 0)))
                    .Query(qd => qd.MatchAll())
                    .Conflicts(Conflicts.Proceed)                    
                    .WaitForCompletion()                    
                    .Refresh()
                );

Another resolution what I found, instead of deleting all the data from index, now we are deleting index itself and recreating it which is a speedy process.

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