Skip to content

Content search

POST
/v0/namespaces/{namespace}/query/grep

Searches file content with a regular expression, accelerated by the namespace’s grep index. Matches are verified against the real pattern and returned in ascending (inode_id, byte_offset) order; revisions committed after the index watermark are scanned exhaustively unless allow_stale skips them. Requires this deployment to serve grep and the namespace to carry a materialized steady-state grep root.

namespace
required
string

Namespace id

One content-search request.

object
allow_scan

Permit a capped exhaustive scan when the pattern yields no required grams. Refused beyond the server’s scan budget.

boolean
allow_stale

When the unindexed tail exceeds the scan budget, return indexed-only results (reported via tail_scanned: false) instead of failing with index_lagging.

boolean
case_insensitive

Match case-insensitively. Verification is exact; the index remains consulted through its case-folded grams.

boolean
cursor

Resume cursor from a previous page. The cursor resumes strictly after the last candidate the issuing page finished scanning and is bound to that page’s request; each page is evaluated against the namespace head at page time.

string | null
limit

Maximum matches per page.

integer | null format: int32
path_prefix
One of:
null
pattern
required

Regular expression used to search file contents. Backreferences and lookaround assertions are not supported. Indexed searches require a run of at least 3 consecutive literal bytes (typically 3 ASCII characters); otherwise the request returns query_unindexable unless allow_scan is set.

string

One page of matches

One content-search page.

object
built_through_seq
required

Commits at or below this sequence were answered from the index.

integer format: int64
head_seq
required

Sequence this page was evaluated at. Pages are evaluated against the namespace head at page time; the cursor is an ordering resume, not a snapshot pin.

integer format: int64
matches
required

Matches in ascending (inode_id, byte_offset) order. A page may return fewer matches than its limit and still carry a cursor: the per-page verified-candidate budget bounds how much content one request reads, whatever the plan’s false-positive rate.

Array<object>

One line-oriented match.

object
absolute_path
required

The file’s absolute path, derived at the snapshot.

string
byte_offset
required

Byte offset of the match within the file.

integer format: int64
inode_id
required

Durable identity of the matched file.

integer format: int64
line
required

The matching line, truncated to the server’s line cap.

string
line_number
required

One-based line number of the match.

integer format: int64
line_truncated

True when line was truncated.

boolean
revision_no
required

The matched revision (the newest visible one at the snapshot).

integer format: int64
namespace_id
required

Namespace searched.

string
next_cursor

Present when another page follows.

string | null
tail_scanned
required

True when revisions after built_through_seq were scanned exhaustively; false only when allow_stale skipped them.

boolean

Invalid pattern, cursor, or an unindexable pattern without allow_scan

HTTP error body used by LoonFS APIs.

object
code
required

Stable machine-readable reason from the ErrorCode registry.

Carried as a string so clients keep working when a newer server introduces a code they do not know; use ErrorCode::parse for typed access.

string
details
One of:
null
feature

For not_supported errors, the capability-document feature key the client should reconcile against.

string | null
message
required

Human-readable error message.

string
request_id

Correlation id the server assigned to the failed request; the same value is sent as the x-request-id response header.

string | null

Unauthorized

HTTP error body used by LoonFS APIs.

object
code
required

Stable machine-readable reason from the ErrorCode registry.

Carried as a string so clients keep working when a newer server introduces a code they do not know; use ErrorCode::parse for typed access.

string
details
One of:
null
feature

For not_supported errors, the capability-document feature key the client should reconcile against.

string | null
message
required

Human-readable error message.

string
request_id

Correlation id the server assigned to the failed request; the same value is sent as the x-request-id response header.

string | null

The backing store rejected its configured credentials

HTTP error body used by LoonFS APIs.

object
code
required

Stable machine-readable reason from the ErrorCode registry.

Carried as a string so clients keep working when a newer server introduces a code they do not know; use ErrorCode::parse for typed access.

string
details
One of:
null
feature

For not_supported errors, the capability-document feature key the client should reconcile against.

string | null
message
required

Human-readable error message.

string
request_id

Correlation id the server assigned to the failed request; the same value is sent as the x-request-id response header.

string | null

Namespace not found

HTTP error body used by LoonFS APIs.

object
code
required

Stable machine-readable reason from the ErrorCode registry.

Carried as a string so clients keep working when a newer server introduces a code they do not know; use ErrorCode::parse for typed access.

string
details
One of:
null
feature

For not_supported errors, the capability-document feature key the client should reconcile against.

string | null
message
required

Human-readable error message.

string
request_id

Correlation id the server assigned to the failed request; the same value is sent as the x-request-id response header.

string | null

Namespace deleted

HTTP error body used by LoonFS APIs.

object
code
required

Stable machine-readable reason from the ErrorCode registry.

Carried as a string so clients keep working when a newer server introduces a code they do not know; use ErrorCode::parse for typed access.

string
details
One of:
null
feature

For not_supported errors, the capability-document feature key the client should reconcile against.

string | null
message
required

Human-readable error message.

string
request_id

Correlation id the server assigned to the failed request; the same value is sent as the x-request-id response header.

string | null

The grep index is corrupt or its backing store is unavailable

HTTP error body used by LoonFS APIs.

object
code
required

Stable machine-readable reason from the ErrorCode registry.

Carried as a string so clients keep working when a newer server introduces a code they do not know; use ErrorCode::parse for typed access.

string
details
One of:
null
feature

For not_supported errors, the capability-document feature key the client should reconcile against.

string | null
message
required

Human-readable error message.

string
request_id

Correlation id the server assigned to the failed request; the same value is sent as the x-request-id response header.

string | null

This deployment does not serve grep queries, the grep index is not enabled, or its backfill has not completed on this namespace

HTTP error body used by LoonFS APIs.

object
code
required

Stable machine-readable reason from the ErrorCode registry.

Carried as a string so clients keep working when a newer server introduces a code they do not know; use ErrorCode::parse for typed access.

string
details
One of:
null
feature

For not_supported errors, the capability-document feature key the client should reconcile against.

string | null
message
required

Human-readable error message.

string
request_id

Correlation id the server assigned to the failed request; the same value is sent as the x-request-id response header.

string | null

The index trails the head past the scan budget

HTTP error body used by LoonFS APIs.

object
code
required

Stable machine-readable reason from the ErrorCode registry.

Carried as a string so clients keep working when a newer server introduces a code they do not know; use ErrorCode::parse for typed access.

string
details
One of:
null
feature

For not_supported errors, the capability-document feature key the client should reconcile against.

string | null
message
required

Human-readable error message.

string
request_id

Correlation id the server assigned to the failed request; the same value is sent as the x-request-id response header.

string | null