Created
August 19, 2016 12:13
-
-
Save rayrutjes/eb49da31d3e1fa916a2e7334826cbad5 to your computer and use it in GitHub Desktop.
Quick script to test calls to Algolia indices.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var algoliasearch = require('algoliasearch'); | |
const APP_ID = 'whatever'; | |
const API_KEY = 'whatever'; | |
const INDEX_NAME = "test"; | |
var client = algoliasearch(APP_ID, API_KEY); | |
var index = client.initIndex(INDEX_NAME); | |
index.search( | |
// search text (`query`) | |
"test", | |
// search parameters | |
{ | |
"attributesToRetrieve": ["name"] | |
}, | |
// callback | |
function (error, content) { | |
if (error) { | |
console.error("ERROR: " + error); | |
} else { | |
console.log(JSON.stringify(content, null, " ")); | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment