Version
- Works in node and all browsers (including IE11+)
- Built with TypeScript" down from "Features" to match the Autocomplete libraries
Related Integrations
- InstantSearch for React, Vue, Angular, vanilla
- Works with Autocomplete
- Netlify, Salesforce
First, install Algolia JavaScript API Client via the npm package manager: (if needed, get a free account here)
1npm install algoliasearch
Then, create objects on your index:
1const algoliasearch = require("algoliasearch"); 2 3const client = algoliasearch("YourApplicationID", "YourAdminAPIKey"); 4const index = client.initIndex("your_index_name"); 5 6const objects = [ 7 { 8 objectID: 1, 9 name: "Foo" 10 } 11]; 12 13index 14 .saveObjects(objects) 15 .then(({ objectIDs }) => { 16 console.log(objectIDs); 17 }) 18 .catch(err => { 19 console.log(err); 20 });
Finally, let's actually search using the search method:
1index 2 .search("Fo") 3 .then(({ hits }) => { 4 console.log(hits); 5 }) 6 .catch(err => { 7 console.log(err); 8 });
Learn how to import your existing data in Salesforce using Algolia API clients
Learn how to import your existing data in Google Drive using Algolia API clients
Import your existing data in Confluence using Algolia API clients