/// <summary>
        /// Executes an asyncronus DeleteQuery using the Delete API and removes a document from the associated index.
        /// https://www.elastic.co/guide/en/elasticsearch/reference/5.4/docs-delete.html
        /// </summary>
        /// <typeparam name="TPoco">Has to Implement the IElasticPoco interface</typeparam>
        /// <param name="query">DeleteQuery object</param>
        /// <returns>Returnes the number of effected documents.</returns>
        public async Task <int> ExecuteDeleteAsync <TPoco>(IDeleteExecutable <TPoco> deleteQuery)
            where TPoco : IElasticPoco
        {
            var query = deleteQuery as DeleteQuery <TPoco>;

            if (query == null)
            {
                throw new Exception("Invalid delete request!");
            }

            var statement = Generator.Generate(query);
            var response  = !string.IsNullOrEmpty(query?.Poco.Id) ?
                            LowLevelClient.DeleteAsync <string>(query.IndexName, query.TypeName, query.Poco.Id) :
                            LowLevelClient.DeleteByQueryAsync <string>(query.IndexName, statement);

            return(ProcessDeleteResponse(await response));
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="delete"></param>
 /// <param name="client"></param>
 public static async Task <int> ExecuteAsyncWith <TPoco>(this IDeleteExecutable <TPoco> delete, ElasticLiteClient client)
     where TPoco : IElasticPoco => await client.ExecuteDeleteAsync(delete);
 /// <summary>
 ///
 /// </summary>
 /// <param name="delete"></param>
 /// <param name="client"></param>
 public static int ExecuteWith <TPoco>(this IDeleteExecutable <TPoco> delete, ElasticLiteClient client)
     where TPoco : IElasticPoco => client.ExecuteDelete(delete);