algoliasearch
TypeScript icon, indicating that this package has built-in type declarations

4.23.3 • Public • Published

Algolia for JavaScript

The perfect starting point to integrate Algolia within your JavaScript project

NPM version NPM downloads jsDelivr Downloads License

DocumentationInstantSearchCommunity ForumStack OverflowReport a bugSupport

✨ Features

  • Thin & minimal low-level HTTP client to interact with Algolia's API
  • Works both on the browser and node.js
  • UMD compatible, you can use it with any module loader
  • Built with TypeScript

💡 Getting Started

First, install Algolia JavaScript API Client via the npm package manager:

npm install algoliasearch

Then, create objects on your index:

const algoliasearch = require("algoliasearch");

const client = algoliasearch("YourApplicationID", "YourAdminAPIKey");
const index = client.initIndex("your_index_name");

const objects = [
  {
    objectID: 1,
    name: "Foo"
  }
];

index
  .saveObjects(objects)
  .then(({ objectIDs }) => {
    console.log(objectIDs);
  })
  .catch(err => {
    console.log(err);
  });

Finally, let's actually search using the search method:

index
  .search("Fo")
  .then(({ hits }) => {
    console.log(hits);
  })
  .catch(err => {
    console.log(err);
  });

For full documentation, visit the online documentation.

📄 License

Algolia JavaScript API Client is an open-sourced software licensed under the MIT license.

Dependencies (15)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i algoliasearch

    Weekly Downloads

    1,487,091

    Version

    4.23.3

    License

    MIT

    Unpacked Size

    210 kB

    Total Files

    15

    Last publish

    Collaborators

    • millotp
    • shortcuts
    • haroenv
    • iam4x
    • vvo
    • speedblue
    • bobylito
    • redox
    • pixelastic
    • proudlygeek