diff --git a/src/main/java/com/knowledge/base/infrastructure/south/es/FileElasticsearchGateway.java b/src/main/java/com/knowledge/base/infrastructure/south/es/FileElasticsearchGateway.java index 4a34502..e099c16 100644 --- a/src/main/java/com/knowledge/base/infrastructure/south/es/FileElasticsearchGateway.java +++ b/src/main/java/com/knowledge/base/infrastructure/south/es/FileElasticsearchGateway.java @@ -187,8 +187,8 @@ public class FileElasticsearchGateway { String docId = docModel.buildDocId(); Map source = BeanUtil.beanToMap(docModel, false, true); IndexRequest request = new IndexRequest(INDEX_NAME).id(docId).source(source); - IndexResponse response = esClient.index(request, RequestOptions.DEFAULT); - return response.status().getStatus() == RestStatus.OK.getStatus(); + esClient.index(request, RequestOptions.DEFAULT); + return true; } catch (Exception e) { log.error("ES 写入文档失败: doc={}", docModel, e); return false;