【问题标题】:NEST Wait for the server to finish indexing after bulk insertNEST 批量插入后等待服务器完成索引
【发布时间】:2021-08-13 13:19:04
【问题描述】:

我正在使用 Nest 7.0 为许多文档编制索引:

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

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

【问题讨论】:

    标签: c# .net elasticsearch nest


    【解决方案1】:

    IndexManyAsync 之后调用索引刷新就可以了

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

    【讨论】:

      猜你喜欢
      • 2021-10-14
      • 2022-01-04
      • 1970-01-01
      • 2016-01-24
      • 2019-11-01
      • 1970-01-01
      • 2021-08-14
      • 2015-08-18
      • 2022-08-10
      相关资源
      最近更新 更多