线上 es 全文检索升级到8.14.1 版本导致数据更新异常调整(不抛出异常),实际数据已经被操作
1 files modified
34 ■■■■ changed files
src/main/java/org/springblade/es/service/ElasticsearchDocumentService.java 34 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/es/service/ElasticsearchDocumentService.java
@@ -173,9 +173,9 @@
                    // 刷新索引,确保文档可搜索
                    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());
            }
        }
        // 返回
@@ -226,9 +226,9 @@
                    // 刷新索引,确保文档可搜索
                    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());
            }
        }
        // 返回
@@ -278,9 +278,9 @@
                    // 刷新索引,确保文档可搜索
                    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());
            }
        }
        // 返回
@@ -329,9 +329,9 @@
                    // 刷新索引,确保文档可搜索
                    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());
            }
        }
        // 返回
@@ -363,7 +363,7 @@
                    "articleType", article.getArticleType()
                );
            } catch (IOException e) {
                e.printStackTrace();
//                e.printStackTrace();
            }
        }
    }
@@ -389,7 +389,7 @@
                    "communityCode", placeService.getCommunityCode(place.getId())
                );
            } catch (IOException e) {
                e.printStackTrace();
//                e.printStackTrace();
            }
        }
    }
@@ -415,7 +415,7 @@
                    "communityCode", houseService.getCommunityCode(house.getId())
                );
            } catch (IOException e) {
                e.printStackTrace();
//                e.printStackTrace();
            }
        }
    }
@@ -442,7 +442,7 @@
                    "communityCode", householdService.getCommunityCode(household.getId())
                );
            } catch (IOException e) {
                e.printStackTrace();
//                e.printStackTrace();
            }
        }
    }
@@ -619,9 +619,9 @@
                    // 输出操作结果
                    boolean acknowledged = deleteResponse.isAcknowledged();
                    System.out.println("索引删除成功: " + acknowledged);
//                    System.out.println("索引删除成功: " + acknowledged);
                } catch (IOException e) {
                    e.printStackTrace();
//                    e.printStackTrace();
                }
            }
        }
@@ -639,7 +639,7 @@
        try {
            indexDocument(esParam.getIndexName(), str);
        } catch (IOException e) {
            e.printStackTrace();
//            e.printStackTrace();
        }
        return true;
    }
@@ -689,7 +689,7 @@
                // 刷新索引,确保文档可搜索
                client.indices().refresh(new RefreshRequest(esParam.getIndexName()), RequestOptions.DEFAULT);
            } catch (IOException e) {
                e.printStackTrace();
//                e.printStackTrace();
            }
        }
    }
@@ -773,7 +773,7 @@
                BulkByScrollResponse bulkResponse =
                    client.deleteByQuery(deleteByQueryRequest, RequestOptions.DEFAULT);
            } catch (IOException e) {
                e.printStackTrace();
//                e.printStackTrace();
            }
        }
        return true;