Javascript

JavaScript + Algolia

Build search experiences with UI components and libraries.

Sign up
What is Algolia

What is Algolia

Algolia empowers modern developers to build world class search and discovery experiences without any DevOps.
Libraries with every major language and framework make it easy to enrich your users' experiences. 

Javascript illus

Add instant-search to javascript applications

InstantSearch js library is pre-built, customizable and flexible UI widgets to create your own search experiences -  explore the showcase, it has server side rendering and routing capabilities. It is Open source, production-ready and maintained by Algolia.

Features

  • Gives API access to all Algolia functionality, settings, advanced features, and ML/AI products including Recommend

  • Works in node and all browsers (including IE11+)

  • Supports dynamic modules (load only what you need)

  • Built with Typescript

  • All major module formats (ESM, CJS, UMD)

  • Background retry strategy to ensure uptime

  • Thin & minimal low-level HTTP client to interact with Algolia's API

  • Batching via iterators to optimize number of network calls

  • Zero downtime reindexing feature

Version

  • Works in node and all browsers (including IE11+)

  • Built with TypeScript" down from "Features" to match the Autocomplete libraries

Related Integrations

Get started

  • First, install Algolia JavaScript API Client via the npm package manager: (if needed, get a free account here)
    1
    npm install algoliasearch
  • Then, create objects on your index:
    1
    const algoliasearch = require("algoliasearch");
    2
    3
    const client = algoliasearch("YourApplicationID", "YourAdminAPIKey");
    4
    const index = client.initIndex("your_index_name");
    5
    6
    const objects = [
    7
      {
    8
        objectID: 1,
    9
        name: "Foo"
    10
      }
    11
    ];
    12
    13
    index
    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:
    1
    index
    2
      .search("Fo")
    3
      .then(({ hits }) => {
    4
        console.log(hits);
    5
      })
    6
      .catch(err => {
    7
        console.log(err);
    8
      });
Get started for free
Explore developer docs