stores

Match store chunks against a regular expression

Changed on

Match store chunks against a regular expression.

Unlike /stores/search, this runs your regex against the literal text of each chunk. Use it to find chunks containing a specific token, identifier, error code, or literal phrase.

grep matches across all requested stores and returns at most top_k chunks in total. Matches are unranked and interleaved across stores in the order requested, preserving each store's result order. Pagination is not supported; raise top_k to retrieve more matches.

Args: grep_params: Grep configuration including: - pattern: RE2 regular expression matched against chunk text - targets: chunk content groups to match (text, generated) - case_sensitive: whether the pattern is case-sensitive - store_identifiers: IDs or names of the stores to grep - file_ids: optional list of file IDs to filter chunks by - filters: optional metadata filter conditions - top_k: number of matches to return

Returns: StoreGrepResponse containing the list of matching chunks.

Raises: HTTPException (400): If grep parameters are invalid HTTPException (404): If the store is not found

post/v1/stores/grep

Request

  • Base URL
    https://api.mixedbread.com
  • URL
    https://api.mixedbread.com/v1/stores/grep
  • Auth
    HTTP bearer

Headers

X-Mxbai-Tool-Ticketstring nullable

Ticket from a chat completion's tool_tickets, proving this call runs a tool call that completion asked for. Redeems once, and bills the operation at the discounted agent rate.

Request body

top_kinteger

Number of results to return

patternstring required

Regular expression (RE2 syntax) matched against chunk text

targetsStoreChunkGrepTarget[]

Chunk content groups to match against. text matches the original text of text chunks; generated matches ingestion-derived fields (transcription, OCR text, summaries).

case_sensitiveboolean

Whether the regular expression is case-sensitive

return_metadataboolean

Whether to return file metadata

Example request

{
  "filters": {
    "all": [
      {
        "key": "price",
        "operator": "gt",
        "value": "100"
      },
      {
        "key": "color",
        "operator": "eq",
        "value": "red"
      }
    ],
    "any": [
      {
        "key": "price",
        "operator": "gt",
        "value": "100"
      },
      {
        "key": "color",
        "operator": "eq",
        "value": "red"
      }
    ],
    "none": [
      {
        "key": "price",
        "operator": "gt",
        "value": "100"
      },
      {
        "key": "color",
        "operator": "eq",
        "value": "red"
      }
    ]
  },
  "pattern": "ERR-\\d{4}"
}

Response

List of chunks whose text matches the pattern

object'list'

The object type of the response

Example response

{
  "data": [
    {
      "mime_type": "text/plain",
      "model": "text-embedding-ada-002",
      "score": 0.5,
      "file_id": "file1",
      "filename": "file1",
      "store_id": "store1",
      "external_id": "ext-123",
      "metadata": {
        "key": "value"
      },
      "file_url": "https://storage.mixedbread.com/org1/files/file1.pdf?X-Amz-Signature=...",
      "context": "This chunk is from an SEC filing on ACME corp's Q2 2023 performance.",
      "summary": "A short overview of ACME's Q2 2023 performance."
    }
  ]
}

Changes

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ///////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////// to the response with the status