Search indexes

Searches an index, forgiving typos.

POST /v1/index/indexes/{uid}/search

Addresshttps://api.hanzo.ai/v1/index/indexes/{uid}/search
MethodPOST
Operationpost_index_indexes_by_uid_search
AuthAuthorization: Bearer $HANZO_API_KEY

Searches an index, forgiving typos.

Ranks the org's documents in one index against q and answers the matching documents whole, most relevant first. A prefix matches, so a partial word finds the documents containing it, and filter narrows the result to documents whose filterable attributes match — which is how a caller scopes results to one end user within its own org.

estimatedTotalHits is the dialect's name for the count; every hit is materialised here, so for this page it is exact. An index this org does not hold answers 404 carrying the dialect's index_not_found.

Request

5 fields, body application/json (required).

FieldInTypeRequiredDescription
uidpathstringyes
filterbodyany—Filter narrows the hits, in the dialect's filter syntax: a string, or an array of strings combined with AND.
limitbodyinteger (int64)—Limit is how many hits to return.
offsetbodyinteger (int64)—Offset is where to start.
qbodystring—Q is the search text.

Response

StatusBodyMeaning
200index.indexHitsok
defaultproblem-detailsrefused

200 body — 6 fields.

FieldInTypeAlwaysDescription
estimatedTotalHitsbodyinteger (int64)—EstimatedTotalHits is the dialect's name for the match count.
hitsbodyany[]—Hits are the matching documents, most relevant first, exactly as stored.
limitbodyinteger (int64)—Limit is how many hits this page could hold.
offsetbodyinteger (int64)—Offset is where this page starts.
processingTimeMsbodyinteger (int64)—ProcessingTimeMs is how long the query took, in milliseconds.
querybodystring—Query echoes the search terms, which is what a client renders above the results.

Failure carries the platform error shape — see Errors.

Examples

hanzo index indexes search <uid>
import { Configuration, IndexApi } from 'hanzoai';

const api = new IndexApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postIndexIndexesByUidSearch({ uid: 'uid', filter: "<filter>", limit: 0 });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import IndexApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = IndexApi(client).post_index_indexes_by_uid_search(uid='uid', filter="<filter>", limit=0)
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.IndexAPI.PostIndexIndexesByUidSearch(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, index_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = index_api::post_index_indexes_by_uid_search(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.IndexApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new IndexApi(client).postIndexIndexesByUidSearch();
curl -X POST https://api.hanzo.ai/v1/index/indexes/<uid>/search \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "filter": "<filter>",
       "limit": 0
     }'

MCP reaches index through the index tool, which names its 14 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "get_index_health"
         }
       }
     }'

Index API · All Hanzo APIs · Interactive reference

Was this page useful?