Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【fix】fix delete aggre type #20

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions es-client/src/main/java/PublicClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ public static void insert(Map<String, Object> data, String index) throws Excepti
IndexResponse indexResponse = restHighLevelClient.index(indexRequest, RequestOptions.DEFAULT);
}

public static void insertByType(Map<String, Object> data, String index, String type) throws Exception {
IndexRequest indexRequest = new IndexRequest(index).id((String) data.get("path") + "/" + type).source(data);
IndexResponse indexResponse = restHighLevelClient.index(indexRequest, RequestOptions.DEFAULT);
}

public static void deleteExpired(Set<String> idSet, String index) {
try {
int scrollSize = 500;//一次读取的doc数量
Expand Down
6 changes: 2 additions & 4 deletions openeuler/src/main/java/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ public static void main(String[] args) {
PublicClient.CreateClientFormConfig(APPLICATION_PATH);
PublicClient.makeIndex(INDEX_PREFIX + "_zh", MAPPING_PATH);
PublicClient.makeIndex(INDEX_PREFIX + "_en", MAPPING_PATH);
fileDate();
sigData();
etherpadData();
releaseData();
fileDate();
} catch (Exception e) {
LOGGER.error(e.getMessage());
LOGGER.error(e.toString());
Expand Down Expand Up @@ -233,7 +233,7 @@ public static void releaseData() {
try {
Map<String, Object> escape = Parse.parseAggreReleaseData(files);
if (null != escape) {
PublicClient.insert(escape, INDEX_PREFIX + "_" + escape.get("lang"));
PublicClient.insertByType(escape, INDEX_PREFIX + "_" + escape.get("lang"), (String) escape.get("type"));
} else {
LOGGER.info("parse null :" + aggreFile.getPath());
}
Expand Down Expand Up @@ -267,10 +267,8 @@ public static void fileDate() throws Exception {
try {
Map<String, Object> escape = Parse.parse(paresFile);
if (null != escape) {
if (!"packages".equals(escape.get("type"))) {
inserDataList.add(escape);
idSet.add((String) escape.get("path"));
}
} else {
LOGGER.info("parse null : " + paresFile.getPath());
}
Expand Down
Loading