dou760663 2017-08-09 14:18 采纳率: 100%
浏览 382

如何检查ElasticSearch BulkProcessor服务是否存在

I am using elastic package for golang. I want to use its BulkProcessor for sending huge amount of documents in background. As per shown in wiki, I could create a processor. But I don't want to create it every time I send the documents. I want to know if there is processor service exists in the connection and pass data to existing processor rather than creating new. How can I achieve it?

  • 写回答

1条回答 默认 最新

  • dongying3830 2017-08-09 14:37
    关注

    Register the bulk processor separately from sending the documents. The bulk processor only lives as long as your process, so to ensure you only create it once, create it when your process starts. Then elsewhere in your application, you can send documents whenever you need to.

    Alternatively, if you must do it on-demand, you can use a sync.Once to ensure the creation only happens once.

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料