elasticsearch - The RestHighLevelClient cannot be used with elasticsearch 7 BulkProcessor. Which client should be used?
问题描述
The elasticsearch 7 documentation - https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-bulk-processor.html
mentions the client to be used as follows- https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/client.html
Here HightLevelRest Client cannot be used with bulkprocessor in elastisearch7.
This is different from what they had suggested in elasticsearch 6 - https://www.elastic.co/guide/en/elasticsearch/client/java-api/6.4/client.html
Could someone mention which client they use with bulkprocessor in elasticsearch 7
解决方案
RestHighLevelClient 可以与 ElasticSearch7 BulkProcessor 一起使用。你应该看看源代码。唯一的变化是 RestHighLevelClient bulkAsycn 方法。它现在需要一个额外的参数 RequestOptions。所以以前的签名是 -
BulkProcessor.builder(restHighLevelClient()::bulkAsync, listener);
新签名如下:
BulkProcessor.builder((request, bulkListener) -> restHighLevelClient.bulkAsync(request, RequestOptions.DEFAULT, bulkListener), bulkProcessorListener
);
希望能帮助到你
推荐阅读
- unity3d - 字符串文字在螺栓可视化脚本中不适用
- flutter - Mapbox SDK 注册表令牌为空
- python - 在学习曲线的某个点之后,测试分数下降到训练分数以下
- python - 使用数组指定项目出现的特定概率(例如 75%)以确保每次试验的准确百分比
- c# - 使用 Raycast 在编辑器脚本中检测游戏对象
- javascript - 确定用户操作,即是/否,当 chrome 警报以 Javascript 启动应用程序时
- javascript - 如何在使用 javascript 裁剪上传的图像后获取大小
- php - 如果用户未登录,自定义运输方式费用不会添加到发票中
- sitecore - 在所有保存时在富文本编辑器中向上滚动 - Sitecore
- reactjs - bootstrap 5 切换导航在 Next.js 中不起作用