UNPKG

@webiny/api-headless-cms-ddb-es

Version:

DynamoDB and Elasticsearch storage operations plugin for Headless CMS API.

31 lines (30 loc) 625 B
import { configurations } from "../configurations.js"; export const deleteElasticsearchIndex = async params => { const { client, model } = params; const { index } = configurations.es({ model }); const { body: exists } = await client.indices.exists({ index }); if (!exists) { return; } try { await client.indices.delete({ index, ignore_unavailable: true }); } catch (ex) { console.log(`Could not delete Elasticsearch index "${index}". Please do it manually.`); console.log(ex.message); } }; //# sourceMappingURL=deleteElasticsearchIndex.js.map