$ memista

Run a nearest-neighbour search

Query a partition with POST /v1/search: the request shape, how the inner-product metric ranks results, and what comes back.

Difficulty: beginnerTime: 5 min

Once a partition has data, POST /v1/search runs a k-nearest-neighbour query.

The request

curl -X POST http://localhost:8083/v1/search \
  -H "Content-Type: application/json" \
  -d '{
    "database_id": "my_app",
    "query": [0.1, 0.2],
    "limit": 5
  }'
  • query — the query vector, same dimensionality as your inserted vectors.
  • limit — how many neighbours to return.

How ranking works

memista uses Inner Product (MetricKind::IP) with F32 quantization. For embeddings you have normalised, inner product ranks identically to cosine similarity — pick your embedding normalisation accordingly. See the glossary for a plain-language note on the metric.

What comes back

USearch returns the ranked keys; memista hydrates the text and metadata for those keys from SQLite and returns them with their distance:

{
  "results": [
    { "chunk_id": 42, "text": "Hello world", "metadata": "{}", "distance": 0.03 }
  ]
}

To tune recall vs. latency you’d fork the load_or_create_index helper — the stock build passes USearch’s default connectivity and expansion_* values. See how it works.

Frequently Asked Questions

What distance metric does search use?

Inner Product (MetricKind::IP) with F32 quantization. For normalised embeddings this ranks the same way cosine similarity would.

Does search read from SQLite?

Yes. USearch returns ranked keys; memista hydrates the text and metadata for those keys back from the SQLite chunks table.

Related

Try memista

A single crate, GPL-3.0. Two files on disk and three endpoints.