How it works


What is Algolia?

Algolia is a hosted full-text, numerical, and faceted search engine capable of delivering realtime results from the first keystroke. Built with developers in mind, Algolia’s powerful API lets you quickly and seamlessly implement realtime search within your websites and mobile applications.

How it works 1

What is algolia

Search engines capable of full-text search, such as Algolia, examine all words within full-text fields in order to find the most relevant records. This capability allows Algolia to quickly search and return records from large volumes of data.

How it works 2

Full text search

The lack of responsiveness in your search engine can damage your business. It has been shown that 100 milliseconds in added latency can cost a business 1% in sales.

Algolia solves this problem by responding to search queries in milliseconds which enables a unique search as you type experience. This allows your users to think less about how to search and more about what they find. Exploring neighboring queries becomes easier, making content browsing more intuitive for your audience.

How it works 3

Added value

A unique search experience

Because Algolia was built with speed and performance at its core for users and developers, search results are available within milliseconds. This means you can easily build a responsive search experience for your users where relevant results are returned on each keystroke. You no longer need to force your users to enter full search terms and redirect them to a separate result page.

#1 Autocomplete Menu

How it works 4


One way to show search results to users is by implementing autocomplete on a search box within your web application. This can be accomplished by adding Twitter typeahead.js and Algolia’s JavaScript library to your web application along with a little bit of JavaScript to tie it together.

What you end up with is a search box that will show and update a dropdown of search results each time a user performs a keystroke.

You can find a tutorial on implementing autocomplete menus.

#2 Instant search result page

How it works 5

Instant search page

Another way to show search results to users is by implementing instant search within your result page by updating the entire page’s results, pagination, and navigation as users type. This method works differently than autocomplete menus but some of the concepts are the same. The results get updated each time a user enters a new value into the search box. In this case, as new search results are returned we will update the whole page including results, pagination, and navigation filters.

To fully implement an instant search result page, we will take advantage of faceted search. Faceted search is the dynamic clustering of hits into categories. It allows users to drill into search results by any value of any attribute.

Here’s a tutorial on implementing instant search result pages.


The Algolia search as you type API has many built-in features, that can easily be configured and used within any search implementation.

All those are available out of the box, and don’t require any extra development on your side.

Relevance & Ranking customization

How it works 6


Algolia search is based on a tie-breaking based ranking algorithm which allows you to blend business metrics to the relevance calculation. This replaces the common and confusing “floating point score” to return much more relevant results.

Typo Tolerance

How it works 7

Typo tolerance

Users misspell words, especially those using mobile devices. Instead of letting these common mistakes ruin your user’s search experience, Algolia’s typo tolerance algorithms will automatically detect what your users are searching for and return the correct results.

Smart highlighting

How it works 8


Each search response contains one or more highlighted results so you can easily show which section and words matched the user’s query. This even works in cases where the user misspelled a query.

Facet as you type

How it works 9


Like smart highlighting, Algolia search results can also contain suggested facets based on the search. With this information, you can easily enhance your navigation, drill down, and refinements based on the user’s query.

Geo awareness

How it works 10

Geo awareness

Searches can be done in a way where they are geo aware. This means search results from queries based on location can contain distance information. This enables you to display nearby search results by distance, or in a particular area.

Global language support

How it works 11

Language support

Algolia works with all languages, including Chinese, Japanese, Korean, and Arabic without any work on your part. This means that both left-to-right and right-to-left scripts are supported.

How it all works

The Algolia solution can be broken down into three steps.

How it works 12

Syncing data

1 - Syncing data

The first thing to do is import existing data from a database into Algolia. After the initial import, the index needs to be kept in sync with the database. This is done by implementing in your application a synchronisation logic (using one of our API client) that will automatically replicate additions, updates, and deletions from your database to your Algolia’s indices.

2 - Ranking & Relevance

The next thing to do once data has been imported is to configure the index for optimal operation. These settings can be found and modified within the dashboard or programmatically using the API.

The last thing to do is implement the search interface within a website, mobile application, or any other application needing search capabilities.

Indices, records and operations

Indices are where all the magic happens. In the simplest terms, an index is an entity within Algolia where you import the data you want to search (indexing) and perform queries against (search). An index within Algolia is analogous to a table within a database except the index is highly optimized for search.

How it works 13


Each item stored within an index is a record. A record is a JSON schema free object you add to your index and then search for. Each attribute in a record can be used for searching, displaying, filtering, or ranking.

Many actions, called operations, can be done against an index. An operation is an atomic action performed on our engine. There are two types of operations: index and search operations.

  • Indexing is the process of adding, updating, deleting, or manipulating the data within the index.
  • Searching is the process of querying the data stored in the index to return relevant search results.

One of the great things about having indexing and searching is that you end up with a push once and consume everywhere model. What this means is that you can import your data once into an index and then search that data from any number of clients. If you have a website and multiple mobile apps there is no need to have multiple indices. You can setup one index that can be searched by all your clients.

Syncing data into indices

With an understanding of what Algolia is and how indices work, you are ready to learn about indexing your data. Indexing works by iterating over the data in your database you want to be part of the search experience and sending that data to Algolia.

Algolia provides a JSON based REST API for indexing data. This means all data pushed to an Algolia index must be sent as JSON. To make indexing easier, API clients have been developed for most major languages. The API clients can be found on GitHub.

Indexing is not a one time thing. Once your initial data has been indexed, you will want to configure your application to sync your database changes such as additions, updates, and deletions with your indices in Algolia.

It is important when indexing your data to choose which fields should be included. You only want to index data needed for searching, displaying, filtering, and ranking. All other data points not needed for these cases should be excluded in order to keep your index optimized.

Sample record:

  "objectID": 42,                 // record identifier
  "title": "Breaking Bad",        // string attribute
  "episodes": [                   // array of strings attribute
    "Crazy Handful of Nothin'",
    "Gray Matter"
  "like_count": 978,              // numerical attribute
  "avg_stuff": 1.23456,
  "actors": [                     // nested objects attribute
      "name": "Walter White",
      "portrayed_by": "Bryan Cranston"
      "name": "Skyler White",
      "portrayed_by": "Anna Gunn"

Tweak Ranking & Relevance

We provide many ways to configure your index allowing you to tune your overall index relevancy. The most important ones are the searchable attributes and the attributes reflecting record popularity.

The reason our engine is so fast is because each index has its own settings and rankings. This means you are able to create different sets of searchable attributes and attribute ranking relevance by storing your data in multiple indices. This is accomplished using replica indices which are seamlessly synchronized with a primary index. Each replica index can then be configured with its own set of business metrics to tune the relevance calculation.

Searchable attribute

This setting controls which record attributes searches should be performed upon. The order of this setting matters as those at the top of the list are considered more important and control part of the ranking when determining what data to return for queries.

How it works 14

Searchable Attributes (Attributes To Index)

Since this setting controls the attributes searches are performed on, it is important to exclude attributes whose only purpose is for displaying, filtering, or ranking. An example of this would be a link to an image. You want to store and retrieve it to display the image to the user, but it doesn’t make sense to have it be part of the search.

Combining your business data

Algolia’s default ranking includes a customRanking field which allows you to add business metrics to the relevance calculation. This means you can choose any numerical value in your record, that reveal its popularity. It can either be a:

  • Raw value: number of sales on the last 30 days, number of views, number of likes or followers, …
  • Computed value: number of views / nb days since publication, …, value based on your own popularity algorithm

How it works 15

Custom Ranking

A good example of how custom ranking can benefit search results would be an index of blog posts. Each record in the index contains a views attribute which indicates how many times the post has been viewed. This value can be important when users are performing searches to help sort the results using the number of views. By adding the views attribute to the custom ranking setting, search results will be built and sorted by combining the text-relevance criteria with the custom ranking to return the most relevant results.


Once your data has been indexed and your indices properly configured, you are ready to implement search within your site or application.

Searches performed on Algolia indices consist of a full-text query along with zero or more optional parameters. Optional parameters can be used to override configured settings so you can change the behavior of specific searches while leaving others alone.

What does it look like on my site

Our service does not restrict you to any user interface implementation. You are free to make it look like anything you want. Even the two popular methods of implementing Algolia search on sites, autocomplete menus and instant search result pages, can be fully customized to your liking, style, and functionality.

This is all possible because the data returned from search queries is JSON. This allows you to easily consume the search results programmatically and build any user interface you want. These results consist of the following information that can be used by your client user interface.

  • An array of matching hits which includes highlighting details.
  • Pagination information such as current page, number of pages, and hits per page.
  • Total number of matching hits in the index.
  • The processing time spent in our API.
  • List of computed facets.
  • The original query.
  • The original query parameters.

Sample json answer:

  // array of matched hits
  "hits": [
      "objectID": "1",
      "name": "Jim",
      // [... other attributes ...]
      "_highlightResult": {
        // [...]
        // Highlighted attributes
      "objectID": "2",
      "name": "Jimmie",
      // [... other attributes ...]
      "_highlightResult": {
        // [...]
        // Highlighted attributes
  // current page number
  "page": 0,
  // total number of matched hits in the index
  "nbHits": 2,
  // total number of accessible pages
  "nbPages": 1,
  // number of hits per page
  "hitsPerPage": 20,
  // backend processing time (in milliseconds)
  "processingTimeMS": 1,
  // the computed facets
  "facets": {
    "city": {
      "San Francisco": 1, // associated counts
      "NYC": 1
    "title": {
      "CEO": 2
    // [... other facets ...]
  // [...]

Check out some of our demos to get an idea of what is possible.

Frontend implementation

Traditional search implementations tend to have search logic and functionality on the backend. This made sense when the search experience consisted of a user entering a search query, executing that search, and then being redirected to a search result page.

How it works 16

With backend

With Algolia’s hosted search engine, implementing search on the backend is no longer necessary. In fact, in most cases it is harmful to performance because of added network and processing latency. We highly recommend issuing all search requests directly from the end user’s browser, mobile device, or client. It will reduce the overall search latency, and thus allow you to provide an instant “find as you type” experience to your users - offloading your servers at the same time. The following diagrams illustrates why:

How it works 17

With frontend

For your convenience we have JavaScript, Objective-C, Java, and C# API clients for your frontend needs.

Distributed Search Network

Algolia’s Distributed Search Network brings the instant responsiveness of your search engine to users around the world.

Thanks to our 30 data centers, your search engine can now be located where your users are, allowing results delivery times under 50ms in the world’s top markets. DSN is more than a CDN, it’s a synchronized clone of your search engine across the world.

How it works 18


Enabling the Distributed Search Network simply consists of choosing which data center locations you want your indices to reside within. Algolia will handle the rest. Your indices will be automatically synchronized around the world and user queries routed to the closest data center.


How it works 19


Data security is very important to Algolia. We spent a lot of time developing a robust security system from the backend all the way to the client. Our comprehensive API key system allows you to extensively manage access rights, per index, per user, and more.

Team work

How it works 20


Granting access to other team members can be accomplished easily within your Algolia account. Team members are invited by email address and can be granted different privileges depending on how much access you wish to grant.

  • Main dashboard access
  • Analytics dashboard access
  • Configure indices
  • Search indices
  • Access and update billing

Did you find this page helpful?

We're always looking for advice to help improve our documentation! Please let us know what's working (or what's not!) - we're constantly iterating thanks to the feedback we receive.

Send us your suggestions!