@webiny/api-form-builder-so-ddb-es
Version:
[](https://www.npmjs.com/package/@webiny/api-form-builder-so-ddb-es) [](https://www.npmjs.com/package/@webiny
41 lines (39 loc) • 1.12 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createElasticsearchIndex = void 0;
var _apiElasticsearch = require("@webiny/api-elasticsearch");
var _FormElasticsearchIndexPlugin = require("../plugins/FormElasticsearchIndexPlugin");
var _configurations = require("../configurations");
const createElasticsearchIndex = async params => {
const {
elasticsearch,
plugins,
locale,
tenant
} = params;
const {
index
} = _configurations.configurations.es({
locale,
tenant
});
await (0, _apiElasticsearch.createIndex)({
client: elasticsearch,
index,
type: _FormElasticsearchIndexPlugin.FormElasticsearchIndexPlugin.type,
tenant,
locale,
plugins,
onExists: () => {
console.log(`Elasticsearch index "${index}" for the Form Builder already exists.`);
},
onError: ex => {
console.error(`Could not create the Form Builder Elasticsearch index "${index}".`, ex);
return ex;
}
});
};
exports.createElasticsearchIndex = createElasticsearchIndex;
//# sourceMappingURL=createElasticsearchIndex.js.map
;