---
# @generated by sylphx-gen 0.1.0 from contracts@e145cc7cf1bc9605f2b27439e5e17ed76a1a2fd7e7021906a013f7565e4a0cd5. Do not edit.
title: "Query in Search"
description: "`data.search.query` (POST /v1/search/{index_id}): Searches an index by text, by vector, or both, best match first, with filters and paging."
type: reference
product: search
summary: "Searches an index by text, by vector, or both, best match first, with filters and paging."
updated: 2026-09-28
nav: false
---

Searches an index by text, by vector, or both, best match first, with filters and paging.

- **Path** `POST https://api.data.sylphx.com/v1/search/index-id`
- **Scope** `data:read`
- **Effect** `read` — nothing is written.
- **Collection** [search](/docs/api/search)
- **Host** `https://api.data.sylphx.com`

## Request

| Field | Type | What it is |
| --- | --- | --- |
| `index_id` | `string` | The search index's id. Required. |
| `query` | `string` | Text to match, in web-search syntax: words (all must match), "quoted phrases", `or`, and `-word` to exclude. The last word also matches as a word prefix unless `prefix` is false. |
| `vector` | `double[]` | An embedding to match by cosine similarity; its length is the index's vector dimensions. |
| `limit` | `uint32` | At most this many hits, 1 to 100; unset is 20. |
| `offset` | `uint32` | Hits to skip; offset + limit is at most 1000. |
| `filters` | `SearchFilter[]` | Conditions every hit meets, at most 16. |
| `vector_weight` | `double` | The vector list's share of a hybrid score, 0 to 1; unset is 0.5. |
| `prefix` | `bool` | Whether the query's last word also matches as a word prefix; unset is true. |

### SearchFilter

| Field | Type | What it is |
| --- | --- | --- |
| `field` | `string` | A dot path of object keys, for example `price.amount`; at most 8 keys. Required. |
| `op` | `string` | `eq`, `ne`, `in`, `gt`, `gte`, `lt`, `lte`, or `exists`. `eq` and `in` also match an array field that holds the value; `ne` matches documents without the field. Required. |
| `value_json` | `string` | The value as JSON: a string, number, or boolean; for `in`, an array of 1 to 100 of them; for the ranges, a number or string; for `exists`, empty. |

## Response

| Field | Type | What it is |
| --- | --- | --- |
| `hits` | `SearchHit[]` | The hits, best first. |

### SearchHit

| Field | Type | What it is |
| --- | --- | --- |
| `document` | `DocumentRecord` | The document. |
| `score` | `double` | How well it matched; higher is better. The text rank, the cosine similarity, or the fused rank; 0 when listing. |
| `text_score` | `double` | The full-text rank, when the document matched the text. |
| `vector_score` | `double` | The cosine similarity, when the document was in the vector list. |

### DocumentRecord

| Field | Type | What it is |
| --- | --- | --- |
| `index_id` | `string` | The search index's id in the environment, for example `articles`. |
| `document_id` | `string` | The document's id. |
| `document_json` | `bytes` | The document as JSON, base64. |
| `vector` | `double[]` | The document's embedding; its length is the index's vector dimensions. |
| `sha256` | `string` | `sha256:<hex>` of the document. |
| `version` | `uint64` | The version, increasing per document. |
| `updated_at_unix_ms` | `int64` | When this version was written, in Unix milliseconds. |

## Errors

- [`UNAUTHENTICATED`](/docs/api/errors/UNAUTHENTICATED) — No valid key or token was presented.
- [`PERMISSION_DENIED`](/docs/api/errors/PERMISSION_DENIED) — The key lacks the method's permission.
- [`INVALID_FIELD`](/docs/api/errors/INVALID_FIELD) — A field failed validation.
- [`RESOURCE_NOT_FOUND`](/docs/api/errors/RESOURCE_NOT_FOUND) — The named Resource does not exist or is not visible.

Every error arrives in the body [Errors](/docs/platform/errors) describes.

## Examples

**cURL**

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

**TypeScript**

```ts
const response = await sylphx.data.search.query({ indexId: 'index-id' })
```

**Rust**

```rust
let mut req = sylphx::data::SearchRequest::default();
req.index_id = "index-id".to_string();
let response = sx.data().search().query(req).await?;
```

**MCP**

```json
{ "method_id": "data.search.query", "args": {"index_id":"index-id"} }
```
