Skip to content

Instantly share code, notes, and snippets.

@lenkan
Last active May 22, 2019 20:10
Show Gist options
  • Save lenkan/13bea464d3621e340bebee731bc0e72f to your computer and use it in GitHub Desktop.
Save lenkan/13bea464d3621e340bebee731bc0e72f to your computer and use it in GitHub Desktop.
const algolia = require("algoliasearch")
const client = algolia(ALGOLIA_APPLICATIONID, ALGOLIA_APIKEY)
async function run() {
const source = client.initIndex("test-index-from")
const target = client.initIndex("test-index-to")
const task = await client.copyIndex(source.indexName, target.indexName)
await source.waitTask(task.taskID)
}
run().then(() => {
console.log("Finished")
process.exit(0)
}).catch(error => {
console.error(error)
process.exit(1)
})
{
"name": "tmp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"algoliasearch": "^3.33.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment