Skip to content

Search Result Summaries

This reference covers the AI-related search endpoints available on a Searchcraft index and on a federation.

  • GET /index/:index/capabilities Returns AI capability flags for an index.
  • POST /index/:index/search/summary Streams an AI-generated summary of search results using server-sent events.
  • GET /federation/:federation_name/capabilities Returns AI capability flags for a federation.
  • POST /federation/:federation_name/search/summary Streams an AI-generated summary of a federated search’s merged results using server-sent events.

Use the capabilities endpoint to determine whether an index has AI enabled and whether summary generation is configured.

The enabled flag reflects the index’s stored ai_enabled master switch. An index may still report searchSummaryConfigured: true while enabled: false if AI configuration has been saved but the master switch is currently turned off.

Authenticated requests to this endpoint require the READ permission.

The semanticSearchConfigured and intentDetectionModelConfigured flags are covered in the Semantic Search reference.

Terminal window
curl -H "Authorization: read-key-value" https://searchcraft-cluster-url/index/data_test/capabilities
{
"status": 200,
"data": {
"ai": {
"enabled": true,
"searchSummaryConfigured": true,
"llmProviderConfigured": true,
"llmModelConfigured": true,
"semanticSearchConfigured": true,
"intentDetectionModelConfigured": true
}
}
}

GET /federation/:federation_name/capabilities reports AI capability flags for a federation. The response shape is identical to the per-index endpoint above.

A federation owns its AI configuration independently of its member indexes — see Optional AI configuration on the Federation Management page. This endpoint reports on the federation’s own ai_enabled and ai block only; it never inspects member indexes, even if every member index has AI fully configured.

Authenticated requests to this endpoint require a read key scoped to the federation, the same as GET /federation/:federation_name.

A federation ai block that this server build cannot parse (for example, one written by a newer version with fields this version doesn’t recognize) reports as not configured, matching how the AI endpoints themselves treat it.

Terminal window
curl -H "Authorization: read-key-value" https://searchcraft-cluster-url/federation/4_galaxy_news_test/capabilities
{
"status": 200,
"data": {
"ai": {
"enabled": true,
"searchSummaryConfigured": true,
"llmProviderConfigured": true,
"llmModelConfigured": true,
"semanticSearchConfigured": true,
"intentDetectionModelConfigured": true
}
}
}

The summary endpoint accepts the same request body shape as POST /index/:index/search. The payload is a standard Searchcraft query payload.

Authenticated requests to this endpoint require the LLM_RAG_SUMMARIES permission.

Summary responses are streamed as text/event-stream; charset=utf-8.

The endpoint returns 400 in the following situations. Use GET /index/:index/capabilities to check availability before calling the summary endpoint. See Optional AI configuration for how to configure these settings.

ConditionMessage
ai_enabled is falseAI features are disabled for this index
No ai block configuredAI features not configured for this index
ai exists but no search_summary blockSearch summary not configured for this index
Invalid llm_provider valueInvalid LLM provider
Payload contains a semantic clausesemantic query clauses are not supported on the summary endpoint
facet_depth is set to a value other than 1facet_depth {value} is not supported: ... (see Facet Parameters)

Summaries do not include facet counts, so you can add "facets": false to the payload to skip that work.

Terminal window
curl -N -H "Content-Type: application/json" -H "Authorization: read-key-value" --data '{"query":"wireless headphones","limit":5}' https://searchcraft-cluster-url/index/data_test/search/summary
event: metadata
data: {"results_count":3,"cached":false}
event: delta
data: {"content":"Top options include..."}
event: done
data: {"results_count":3}
EventPayloadDescription
metadata{"results_count": number, "cached": boolean}Always the first event. results_count is the number of search hits found. cached is true when both the search results and the generated summary were served from cache.
delta{"content": string}One or more delta events containing the streamed summary text. When there are zero results, a single delta is emitted with the configured empty_state_message instead of calling the LLM.
done{"results_count": number}Final event indicating the stream has completed.
error{"message": string}Emitted if a streaming error occurs.

When a search query returns no hits, the LLM is not called. Instead, the endpoint immediately emits a delta event containing the empty_state_message configured on the index, with the ${searchTopic} placeholder substituted for the matched search term. If a matching keyword rule provides its own empty_state_message, that takes precedence over the index-level default.

POST /federation/:federation_name/search/summary summarizes the merged result set of a federated search. It shares the same summarization pipeline as POST /index/:index/search/summary — request body shape, SSE event sequence, zero-result behaviour, keyword rules, and structured query support below all apply unchanged. The differences are where configuration is resolved from, permission enforcement, caching, and error responses.

The request body is the same as POST /federation/:federation_name/search. See the Federation Management reference for the federated search payload and response shape.

A federation resolves its AI configuration from its own ai_enabled and ai fields, never from member indexes — even if every member index has AI fully configured. See Optional AI configuration on the Federation Management page. Use GET /federation/:federation_name/capabilities to check availability before calling this endpoint.

Authenticated requests to this endpoint require the LLM_RAG_SUMMARIES permission, enforced at the routing level before the request body is read. A federation key that only holds SEARCH (a plain read key) is rejected with 401. The key must also be scoped to the federation itself and hold access to every member index — the same requirement enforced on all /federation/:federation_name/* requests.

ConditionStatusMessage
Federation does not exist404federation {name} does not exist
A member index no longer exists404index {name} does not exist
Federation has no member indexes400No indexes in federation
ai_enabled is false on the federation400AI features are disabled for this federation
No ai block configured on the federation400AI features not configured for this federation
ai exists but no search_summary block400Search summary not configured for this federation
Invalid llm_provider value400Invalid LLM provider
Payload contains a semantic clause400semantic query clauses are not supported on the summary endpoint
facet_depth is set to a value other than 1400facet_depth {value} is not supported: ...

Summaries are cached separately from index summaries, keyed on a combined fingerprint of every member index’s current revision — a write to any member index invalidates the federation’s cached summaries. The underlying federated search reuses the standard federated search cache.

Each request emits one api_summary_requested billing event (including on cache hits), attributed to the first member index in federation order, with the federation name recorded in its own column.

Terminal window
curl -N -H "Content-Type: application/json" -H "Authorization: llm-key-value" --data '{"query":"wireless headphones","limit":5}' https://searchcraft-cluster-url/federation/4_galaxy_news_test/search/summary

The summary endpoint supports the same structured queries as the standard search endpoint.

Terminal window
curl -N -H "Content-Type: application/json" -H "Authorization: read-key-value" --data '{"query":[{"dynamic":{"ctx":"gaming laptop"}},{"term":{"ctx":"Asus","fields":"brand"}}],"limit":5}' https://searchcraft-cluster-url/index/data_test/search/summary

When keyword rules are configured, Searchcraft derives human-readable match text from supported query fragments including fuzzy, exact, dynamic queries.

Keyword rules are configured under ai.search_summary.keyword_rules — on the index declaration for POST /index/:index/search/summary, or on the federation entity for POST /federation/:federation_name/search/summary. See Optional AI configuration for the full rule schema.

Rules are sorted by order and evaluated in that order. The first matching rule wins and no further rules are evaluated.

A rule matches when any keyword in its detect_keywords array is found in the search term. Matching is case-insensitive and substring-based, so a keyword of "nutrition" would also match a query like "malnutrition".

FieldDescription
replacement_termWhen set, replaces the search term submitted to the search engine and used as the topic in the LLM prompt. The original search term is preserved only for display purposes.
custom_instructionAppended to the index-level additional_prompt_instructions when the rule matches.
empty_state_messageOverrides the index-level empty_state_message when the rule matches and the search returns no results. Supports ${searchTopic} placeholder replacement.

The summary endpoint works with any LLM provider configured on the index. Supported providers are:

Providerllm_provider valueCredential
AWS BedrockbedrockAWS SDK credential chain (llm_region required)
llama.cppllamacppNone (llm_base_url required)
OllamaollamaNone
OpenAIopenaillm_api_key
Anthropicanthropicllm_api_key
Google Geminigooglellm_api_key
xAI (Grok)xaillm_api_key
Mistral AImistralllm_api_key

See Optional AI configuration for full configuration examples and field descriptions.