---
title: "Query a table"
method: POST
path: "/v1/table/{id}/query"
tags: ["Table", "Data"]
---

# Query a table

`POST /v1/table/{id}/query`

Query table `id` with vector search, full text search and optional SQL filtering.
Returns results in Arrow IPC file or stream format.

REST NAMESPACE ONLY
REST namespace returns the response as Arrow IPC file binary data
instead of the `QueryTableResponse` JSON object.
The REST response maps to the `QueryTableResponse` model as follows:
- the Arrow IPC file binary body maps to `data`
- response headers map to `context` via the `header.` prefix (see the `Context` schema)

## Path parameters

- `id` string, required

## Query parameters

- `delimiter` string

## Request body

- QueryTableRequest
  - `identity` Identity — Identity information of a request.
    - `api_key` string — API key for authentication. REST NAMESPACE ONLY This is passed via the `x-api-key` header.
    - `auth_token` string — Bearer token for authentication. REST NAMESPACE ONLY This is passed via the `Authorization` header with the Bearer scheme (e.g., `Bearer <token>`).
  - `context` unknown
  - `id` string[]
  - `branch` string — Branch to target. When not specified, the main branch is used.
  - `bypass_vector_index` boolean — Whether to bypass vector index
  - `columns` QueryTableRequestColumns, nullable — Optional field paths to return. Provide either column_names or column_aliases, not both.
    - `column_names` string[] — List of Lance field paths to return. Nested fields use dot-separated segments; use backtick-quoted segments for literal dots and double backticks inside quoted segments.
    - `column_aliases` unknown
  - `distance_type` string — Distance metric to use
  - `ef` integer — Search effort parameter for HNSW index
  - `fast_search` boolean — Whether to use fast search
  - `filter` string — Optional SQL filter expression. Field references in the expression must use Lance field path syntax: nested fields use dot-separated segments, literal dots require backtick-quoted segments, and backticks inside quoted segments are doubled.
  - `full_text_query` QueryTableRequestFullTextQuery, nullable — Optional full-text search query. Provide either string_query or structured_query, not both.
    - `string_query` StringFtsQuery
      - `columns` string[] — Lance field paths to search. Nested fields use dot-separated segments; use backtick-quoted segments for literal dots and double backticks inside quoted segments. Omit to search all indexed FTS fields.
      - `query` string, required
    - `structured_query` StructuredFtsQuery
      - `query` FtsQuery, required — Full-text search query. Exactly one query type field must be provided. This structure follows the same pattern as AlterTransactionAction to minimize differences and compatibility issues across codegen in different languages.
        - `match` MatchQuery
          - `boost` number, float
          - `column` string — Lance field path to match. Nested fields use dot-separated segments; use backtick-quoted segments for literal dots and double backticks inside quoted segments. Omit to use the query default fields.
          - `fuzziness` integer
          - `max_expansions` integer — The maximum number of terms to expand for fuzzy matching. Default to 50.
          - `operator` string — The operator to use for combining terms. Case insensitive, supports both PascalCase and snake_case. Valid values are: - And: All terms must match. - Or: At least one term must match.
          - `prefix_length` integer — The number of beginning characters being unchanged for fuzzy matching. Default to 0.
          - `terms` string, required
        - `phrase` PhraseQuery
          - `column` string — Lance field path to match. Nested fields use dot-separated segments; use backtick-quoted segments for literal dots and double backticks inside quoted segments. Omit to use the query default fields.
          - `slop` integer
          - `terms` string, required
        - `boost` BoostQuery — Boost query that scores documents matching positive query higher and negative query lower
          - `positive` FtsQuery, required — recursive
          - `negative` FtsQuery, required — recursive
          - `negative_boost` number, float — Boost factor for negative query (default: 0.5)
        - `multi_match` MultiMatchQuery
          - `match_queries` MatchQuery[], required
            - `boost` number, float
            - `column` string — Lance field path to match. Nested fields use dot-separated segments; use backtick-quoted segments for literal dots and double backticks inside quoted segments. Omit to use the query default fields.
            - `fuzziness` integer
            - `max_expansions` integer — The maximum number of terms to expand for fuzzy matching. Default to 50.
            - `operator` string — The operator to use for combining terms. Case insensitive, supports both PascalCase and snake_case. Valid values are: - And: All terms must match. - Or: At least one term must match.
            - `prefix_length` integer — The number of beginning characters being unchanged for fuzzy matching. Default to 0.
            - `terms` string, required
        - `boolean` BooleanQuery — Boolean query with must, should, and must_not clauses
          - `must` FtsQuery[], required — Queries that must match (AND)
          - `must_not` FtsQuery[], required — Queries that must not match (NOT)
          - `should` FtsQuery[], required — Queries that should match (OR)
  - `k` integer, required — Number of results to return
  - `lower_bound` number, float — Lower bound for search
  - `nprobes` integer — Number of probes for IVF index
  - `offset` integer — Number of results to skip
  - `prefilter` boolean — Whether to apply filtering before vector search
  - `refine_factor` integer — Refine factor for search
  - `upper_bound` number, float — Upper bound for search
  - `vector` QueryTableRequestVector, nullable, required — Query vector(s) for similarity search. Provide either single_vector or multi_vector, not both.
    - `single_vector` number[] — Single query vector
    - `multi_vector` array[] — Multiple query vectors for batch search
      - number[]
  - `vector_column` string — Lance field path of the vector field to search. Nested fields use dot-separated segments; use backtick-quoted segments for literal dots and double backticks inside quoted segments. Use canonical full paths for display and errors; leaf names alone only identify top-level fields; invalid or unresolved paths should return InvalidInput or TableColumnNotFound.
  - `version` integer — Table version to query
  - `with_row_id` boolean — If true, return the row id as a column called `_rowid`

## Response `200`

Query results in Arrow IPC file format

## Other responses

- `400` — Indicates a bad request error. It could be caused by an unexpected request body format or other forms of request validation failure, such as invalid json. Usually serves application/json content, although in some cases simple text/plain content might be returned by the server's middleware.
- `401` — Unauthorized. The request lacks valid authentication credentials for the operation.
- `403` — Forbidden. Authenticated user does not have the necessary permissions.
- `404` — A server-side problem that means can not find the specified resource.
- `503` — The service is not ready to handle the request. The client should wait and retry. The service may additionally send a Retry-After header to indicate when to retry.
- `5XX` — A server-side problem that might not be addressable from the client side. Used for server 5xx errors without more specific documentation in individual routes.

---

[API](https://skmtc.net/lance-format/apis/lance-namespace-specification.md) · [All operations](https://skmtc.net/lance-format/apis/lance-namespace-specification/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lance-format/lance-namespace-specification/versions/f09656f7f568/schema)
