Why Algolia?
Building search from scratch is painful. Elasticsearch requires servers, tuning, and DevOps. Algolia gives you hosted search-as-a-service with a generous free tier: 10,000 records, 10,000 searches/month.
No infrastructure. No relevance tuning nightmares. Just fast, typo-tolerant search that works out of the box.
Getting Started (5 Minutes)
1. Create Free Account
Sign up at algolia.com — no credit card required. Free plan includes:
- 10,000 records
- 10,000 search requests/month
- InstantSearch UI libraries
2. Get Your API Keys
# From your Algolia dashboard
ALGOLIA_APP_ID=your_app_id
ALGOLIA_SEARCH_KEY=your_search_only_key # safe for frontend
ALGOLIA_ADMIN_KEY=your_admin_key # backend only
3. Index Your Data
const algoliasearch = require("algoliasearch");
const client = algoliasearch("YOUR_APP_ID", "YOUR_ADMIN_KEY");
const index = client.initIndex("products");
const records = [
{ objectID: "1", name: "MacBook Pro", category: "Laptops", price: 1999 },
{ objectID: "2", name: "iPad Air", category: "Tablets", price: 599 },
{ objectID: "3", name: "AirPods Pro", category: "Audio", price: 249 }
];
await index.saveObjects(records);
console.log("Indexed!");
4. Search Your Data
const results = await index.search("macbok"); // typo-tolerant!
console.log(results.hits);
// Returns MacBook Pro — Algolia handles typos automatically
Build a Search UI in React
import algoliasearch from "algoliasearch/lite";
import { InstantSearch, SearchBox, Hits } from "react-instantsearch";
const searchClient = algoliasearch("YOUR_APP_ID", "YOUR_SEARCH_KEY");
function App() {
return (
<InstantSearch searchClient={searchClient} indexName="products">
<SearchBox placeholder="Search products..." />
<Hits hitComponent={Hit} />
</InstantSearch>
);
}
function Hit({ hit }) {
return (
<div>
<h3>{hit.name}</h3>
<p>{hit.category} — ${hit.price}</p>
</div>
);
}
Python Example
from algoliasearch.search.client import SearchClientSync
client = SearchClientSync("YOUR_APP_ID", "YOUR_ADMIN_KEY")
client.save_objects(
index_name="articles",
objects=[
{"objectID": "1", "title": "Getting Started with Algolia", "tags": ["search", "api"]},
{"objectID": "2", "title": "Full-Text Search Best Practices", "tags": ["search", "performance"]}
]
)
results = client.search(
search_method_params={"requests": [{"indexName": "articles", "query": "full text"}]}
)
for hit in results.results[0].hits:
print(hit["title"])
Advanced Features (All Free Tier)
Faceted Search
const results = await index.search("laptop", {
facets: ["category", "brand"],
facetFilters: [["category:Laptops"]]
});
Geo Search
const results = await index.search("restaurant", {
aroundLatLng: "40.7128, -74.0060",
aroundRadius: 5000
});
Algolia vs Alternatives
| Feature | Algolia Free | Elasticsearch | Meilisearch |
|---|---|---|---|
| Hosted | Yes | No (self-host) | Yes (cloud) |
| Typo tolerance | Built-in | Manual | Built-in |
| UI Components | InstantSearch | None | Basic |
| Free tier | 10K records | N/A | 100K docs |
| Latency | <50ms | Varies | <50ms |
Need to scrape data to feed into Algolia? I build production-ready web scrapers. Check out my Apify actors for ready-made scrapers, or email me at spinov001@gmail.com for custom solutions.
What are you building with Algolia? Drop a comment below!
Top comments (0)