java - 检查弹性搜索部署当前是否可用或未使用 Java
问题描述
我已经为弹性搜索CRUD操作创建了一个Java服务我已经在下面给出了我的业务逻辑我正在做我所有的服务器端验证,因为我必须在插入之前检查弹性搜索部署当前是否可用或不使用我的弹性搜索的RestHighLevelClient数据到我的索引。我在下面给出了我的代码。
public String createProfileDocument(EmployeeInformation document, String IndexName) throws Exception {
String Id = document.getId();
if (Strings.isNullOrEmpty(Id)) {
return "ID is null or empty";
}
else if(Strings.isNullOrEmpty(IndexName)) {
return "Index name is null or empty";
}
else if(isTextContainUpperCase(IndexName)){
return "Index name should be in lowercase";
}
else if(logic to check the deployment)
{
return "Elasticsearch deployment is not reachable";
}
IndexRequest indexRequest = new IndexRequest(IndexName);
indexRequest.id(document.getId());
indexRequest.source(convertProfileDocumentToMap(document), XContentType.JSON);
IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);
return indexResponse.getResult().name();
}
有人可以帮助我在上面的代码中实现这一点吗?提前致谢
解决方案
推荐阅读
- python - 在不同类别的数据框中汇总数据
- react-native - 在进入屏幕时运行 api fetch
- c# - 计算负数的三次根
- android - 如何在“。”之前显示值 符号?
- python - 将虚线与其他图像伪影分开
- macos - 处理 NSMenuDelegate menuWillOpen 以改变目标
- discord.js - 验证机器人不添加角色
- javascript - 将文本文件动态读入页面
- excel - How to stack 2 columns of data with spaces into a single column with no spaces
- android - 到数组适配器的数据绑定仅适用于根文件夹中的模型