Quickstart

Get from zero to search results in five minutes. This guide walks through creating an index, adding documents, and running your first search query.

Prerequisites

  • A running Skirre instance (self-hosted or managed)
  • An admin API key (sk_search_live_...)
Using the SDK?
This guide uses curl for clarity. If you prefer TypeScript, see the SDKs page for the equivalent code using @skirre/sdk.

1. Create an Index

An index is a collection of documents with a defined schema. Define which fields are searchable, filterable, and sortable when you create it.

text
curl -X POST https://search.example.com/v1/indices \
  -H "Authorization: Bearer sk_search_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "uid": "movies",
    "primary_key": "id",
    "searchable_attributes": [
      { "name": "title", "weight": 3.0 },
      { "name": "overview", "weight": 1.0 }
    ],
    "filterable_attributes": [
      { "name": "genre", "field_type": "string" },
      { "name": "year", "field_type": "number" },
      { "name": "rating", "field_type": "number" }
    ],
    "sortable_attributes": ["year", "rating"]
  }'

2. Add Documents

Push JSON documents to your index. Each document must include the primary key field. Skirre accepts batches of up to 1,000 documents per request.

text
curl -X POST https://search.example.com/v1/indices/movies/documents \
  -H "Authorization: Bearer sk_search_live_..." \
  -H "Content-Type: application/json" \
  -d '[
    {
      "id": "1",
      "title": "The Dark Knight",
      "overview": "Batman raises the stakes in his war on crime.",
      "genre": "Action",
      "year": 2008,
      "rating": 9.0
    },
    {
      "id": "2",
      "title": "Inception",
      "overview": "A thief who steals secrets through dreams.",
      "genre": "Sci-Fi",
      "year": 2010,
      "rating": 8.8
    },
    {
      "id": "3",
      "title": "Interstellar",
      "overview": "Explorers travel through a wormhole in space.",
      "genre": "Sci-Fi",
      "year": 2014,
      "rating": 8.7
    }
  ]'

The response confirms how many documents were indexed:

text
{ "indexed": 3 }

Search your index with a simple POST request. You can use a search-only key (pk_search_live_...) for client-side queries.

text
curl -X POST https://search.example.com/v1/indices/movies/search \
  -H "Authorization: Bearer pk_search_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "q": "dark knight" }'
text
{
  "hits": [
    {
      "id": "1",
      "title": "The Dark Knight",
      "overview": "Batman raises the stakes in his war on crime.",
      "genre": "Action",
      "year": 2008,
      "rating": 9.0
    }
  ],
  "total_hits": 1,
  "processing_time_ms": 2,
  "limit": 20,
  "offset": 0,
  "query": "dark knight"
}

4. Add Filters

Narrow results with filter expressions. Any field declared as filterable in the index schema can be used.

text
curl -X POST https://search.example.com/v1/indices/movies/search \
  -H "Authorization: Bearer pk_search_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "q": "",
    "filter": "genre = '\''Sci-Fi'\'' AND rating >= 8.5",
    "sort": ["rating:desc"]
  }'

This returns all Sci-Fi movies rated 8.5 or higher, sorted by rating descending. See the Filtering guide for the full syntax reference.

Next Steps