---
title: Search quickstart
description: Create a search index, take its connection, write a document, query it and delete it again.
type: tutorial
product: search
summary: An index, a document and a query, from the CLI and from curl.
updated: 2026-09-28
order: 1
---

This takes an environment to a queried index. The index itself is a CLI or API
call on the one API; its documents and queries are calls to the data host.

<Prerequisites
	items={[
		'An account, and a project with an environment — see the platform start page',
		'A key with the data:write scope, and data:read for the reads',
	]}
/>

## 1. Create the index

The parent is the environment it belongs to. An empty spec is a valid request,
and it makes a lexical index.

```bash
sylphx data search-indexes create --parent orgs/acme/projects/shop/envs/production
```

```bash
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/search_indexes" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"spec":{}}'
```

`create` answers with an Operation, and the Operation settles with the index.
The final name segment is yours to choose, or the server's to assign when you
leave it out; the run lines on this page address the index as `search-index`.
A positive `--spec.vector-dimensions` is what adds cosine queries, and the
embeddings you write must then be that long.

## 2. Take the connection

An index's engine credentials are not kept anywhere for you to copy. Ask for
them, and they are returned to that caller only:

```bash
sylphx data search-indexes connect orgs/acme/projects/shop/envs/production/search_indexes/search-index
```

The answer carries the host (`{ref}.sylphx.net`), the TLS port (8108 for a
search index), the engine user and password, and a `uri` that embeds them.
`connect` asks for `data:write`: nothing is written, but the answer is a
credential.

## 3. Write a document

The path carries both ids: `index-id` is the id segment of the index's name,
and `document-id` is the document's own id. The pair is the document's
address.

```bash
curl -X PUT "https://api.data.sylphx.com/v1/documents/index-id/document-id" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

A `PUT` replaces the current version of that address — there is no partial
update. The body carries the document as JSON (`document_json`, base64, at
most 1 MiB) and, in an index with dimensions, the `vector` you supply.
`expected_version` makes the write conditional on the version you last read.

The answer is the stored record: the document back, with its `version`,
`sha256` and `updated_at_unix_ms`.

## 4. Query it

```bash
curl -X POST "https://api.data.sylphx.com/v1/search/index-id" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

The body takes `query` (text), `vector` (an embedding), or both, and `limit`
caps the answer — 1 to 100 hits, 20 when unset. The answer is `hits`, best
match first, each one the stored `document` plus the `score` it matched with.

## 5. Delete the document

```bash
curl -X DELETE "https://api.data.sylphx.com/v1/documents/index-id/document-id" \
  -H "Authorization: Bearer $SYLPHX_API_KEY"
```

The answer says whether the document existed, so a delete that finds nothing
is still a successful call. `expected_version` in the query makes the delete
as conditional as the write.

## 6. Delete the index

```bash
sylphx data search-indexes delete orgs/acme/projects/shop/envs/production/search_indexes/search-index --yes
```

<Callout tone="warning" title="Nothing puts an index back">
The `search_indexes` collection has no restore: a delete takes the index and
the documents in it, and the guard against the wrong one is
`deletion_protection`, which makes Delete fail with `DELETION_PROTECTED`
while it is set. The CLI asks before a delete runs unless you pass `--yes`.
</Callout>

<RelatedDocs
	links={[
		{
			href: '/docs/search/indexing',
			label: 'Indexing documents',
			description: 'The three document calls, and the version fence between them.',
		},
		{
			href: '/docs/search/querying',
			label: 'Querying',
			description: 'The fields a query takes, and what comes back.',
		},
		{
			href: '/docs/api/search_indexes',
			label: 'The search_indexes collection',
			description: 'Every method, its scope and its examples.',
		},
	]}
/>
