Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 2787856

Browse files
Delete index before creating
1 parent cb1458c commit 2787856

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/db/genData.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ async function insertIntoES (modelName, body) {
1616
const client = getESClient()
1717

1818
if (_.includes(_.keys(topResources), esResourceName)) {
19+
try {
20+
await client.indices.delete({
21+
index: topResources[esResourceName].index
22+
})
23+
} catch (error) {
24+
// Ignore error. Indice might not exist
25+
}
1926
await client.create({
2027
index: topResources[esResourceName].index,
2128
type: topResources[esResourceName].type,

0 commit comments

Comments
 (0)