Skip to content

Instantly share code, notes, and snippets.

import fs from 'fs';
import algoliasearch from 'algoliasearch';
const IDS_FILE = './query_results.csv';
const indexName = ''; // The index we want
const client = algoliasearch('', ''); // The credentials
const index = client.initIndex(indexName);
const objectIds = fs.readFileSync(IDS_FILE, 'utf8').trim().split('\n').filter(x => /\d/.test(x)).map(x => x.replace(/"/g, ''));