I'm using elastic-app-search REST API to create engine and add it in a meta engine
const axios = require("axios")
const private_key = process.env.elastic_private_key
const search_key = process.env.elastic_search_key
async addSourceEng(metaName, source_engine) {
try {
const response = await axios.patch(process.env.elastic_url, {
"name": metaName,
"source_engines":[source_engine]
}, {
headers: {
Authorization: `Bearer ${private_key}`,
},
});
return data
} catch (error) {
console.log(error);
return error
}
}
I'm using npm package @elastic/app-search-node I've successfully created the engine but can't add it in meta.