elasticsearch - 替代 ES org.elasticsearch.action.delete.DeleteRequest 中已弃用的方法
问题描述
我使用 org.elasticsearch.client:elasticsearch-rest-high-level-client:7.13.2 作为 elasticsearch 依赖项,因为所有以前的版本都在我的组织中被隔离。
但是,由于不推荐使用的方法(如
org.elasticsearch.action.delete.DeleteRequest
org.elasticsearch.action.index.IndexRequest
org.elasticsearch.action.update.UpdateRequest
上述功能是否有替代方法在 ES 中创建/更新/删除文档。我确实搜索了这个主题,但找不到解决方案。
TIA
解决方案
据我所知,仅弃用了多个参数构造函数,仍然可以使用默认构造函数和以索引作为参数的构造函数。
@Deprecated
public IndexRequest(String index, String type) {
super(NO_SHARD_ID);
this.index = index;
this.type = type;
}
public IndexRequest(String index) {
super(NO_SHARD_ID);
this.index = index;
}
这可能是一个愚蠢的建议,但您是否尝试过使用未弃用的构造函数?
推荐阅读
- c# - Why access Task.Result in the synchronous mode doesn't cause a deadlock?
- sql - Select with limit for the same id
- android - 无法在 AndroidStudio 中运行我的第一个项目
- python - 如何将带有条件格式的 pandas df.to_html 表格式化为 Outlook?
- python - 带有 LDAP 和本地帐户的 Django Auth
- c# - 映射没有主索引但具有唯一索引的 Oracle 数据库表
- linux - 如何在 bash 中的 ssh 期望脚本中自动执行 ctrl+d 操作?
- c++ - 绑定到 const 引用的临时对象是否被视为 const 对象?
- mysql - 从表中选择最小值(也是最大值和平均值)以及事件的时间戳
- typescript - 基于现有打字稿的动态类型