Add refresh index method

This commit is contained in:
Hongbo Wu 2022-06-09 12:34:22 +08:00
parent 4f4cc51a37
commit 520ce0077b
2 changed files with 15 additions and 3 deletions

View file

@ -31,3 +31,15 @@ export const initElasticsearch = async (): Promise<void> => {
throw e
}
}
export const refreshIndex = async (): Promise<void> => {
try {
const { body } = await client.indices.refresh({
index: INDEX_ALIAS,
})
console.log('elastic refresh: ', body)
} catch (e) {
console.error('failed to refresh elastic index', e)
throw e
}
}

View file

@ -184,9 +184,9 @@ export const createTestLabel = async (
color: string
): Promise<Label> => {
return getRepository(Label).save({
user: user,
name: name,
color: color,
user,
name,
color,
})
}