NEST 批量插入后等待服务器完成索引

NEST Wait for the server to finish indexing after bulk insert

我正在使用 Nest 7.0 为大量文档编制索引:

await client.IndexManyAsync(docs, myAlias, cancellationToken);

对于我的测试,我需要确保我可以 100% 保证查询索引文档,因为在 IndexManyAsync() 之后等待一段固定的时间并不总是有效。我想我需要一个等效的 ?refresh=wait_for 参数,但在流畅的 API 中找不到任何示例,并且 IndexManyAsync() 没有任何合适的重载:(我该怎么做?

IndexManyAsync 之后调用索引刷新即可完成工作

await elasticClient.Indices.RefreshAsync("index_name");