| | |
| | | // 刷新索引,确保文档可搜索 |
| | | client.indices().refresh(new RefreshRequest(esParam.getIndexName()), RequestOptions.DEFAULT); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | System.out.println("批量插入结果: " + !bulkResponse.hasFailures()); |
| | | // System.out.println("批量插入结果: " + !bulkResponse.hasFailures()); |
| | | } |
| | | } |
| | | // 返回 |
| | |
| | | // 刷新索引,确保文档可搜索 |
| | | client.indices().refresh(new RefreshRequest(esParam.getIndexName()), RequestOptions.DEFAULT); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | System.out.println("批量插入结果: " + !bulkResponse.hasFailures()); |
| | | // System.out.println("批量插入结果: " + !bulkResponse.hasFailures()); |
| | | } |
| | | } |
| | | // 返回 |
| | |
| | | // 刷新索引,确保文档可搜索 |
| | | client.indices().refresh(new RefreshRequest(esParam.getIndexName()), RequestOptions.DEFAULT); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | System.out.println("批量插入结果: " + !bulkResponse.hasFailures()); |
| | | // System.out.println("批量插入结果: " + !bulkResponse.hasFailures()); |
| | | } |
| | | } |
| | | // 返回 |
| | |
| | | // 刷新索引,确保文档可搜索 |
| | | client.indices().refresh(new RefreshRequest(esParam.getIndexName()), RequestOptions.DEFAULT); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | System.out.println("批量插入结果: " + !bulkResponse.hasFailures()); |
| | | // System.out.println("批量插入结果: " + !bulkResponse.hasFailures()); |
| | | } |
| | | } |
| | | // 返回 |
| | |
| | | "articleType", article.getArticleType() |
| | | ); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | "communityCode", placeService.getCommunityCode(place.getId()) |
| | | ); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | "communityCode", houseService.getCommunityCode(house.getId()) |
| | | ); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | "communityCode", householdService.getCommunityCode(household.getId()) |
| | | ); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | // 输出操作结果 |
| | | boolean acknowledged = deleteResponse.isAcknowledged(); |
| | | System.out.println("索引删除成功: " + acknowledged); |
| | | // System.out.println("索引删除成功: " + acknowledged); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | try { |
| | | indexDocument(esParam.getIndexName(), str); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | return true; |
| | | } |
| | |
| | | // 刷新索引,确保文档可搜索 |
| | | client.indices().refresh(new RefreshRequest(esParam.getIndexName()), RequestOptions.DEFAULT); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | BulkByScrollResponse bulkResponse = |
| | | client.deleteByQuery(deleteByQueryRequest, RequestOptions.DEFAULT); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | } |
| | | return true; |