Search Result Summaries
This reference covers the AI-related search endpoints available on a Searchcraft index and on a federation.
API Endpoint Reference
Section titled “API Endpoint Reference”GET /index/:index/capabilitiesReturns AI capability flags for an index.POST /index/:index/search/summaryStreams an AI-generated summary of search results using server-sent events.GET /federation/:federation_name/capabilitiesReturns AI capability flags for a federation.POST /federation/:federation_name/search/summaryStreams an AI-generated summary of a federated search’s merged results using server-sent events.
Capabilities Endpoint
Section titled “Capabilities Endpoint”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.
Example capabilities request
Section titled “Example capabilities request”curl -H "Authorization: read-key-value" https://searchcraft-cluster-url/index/data_test/capabilitiesExample capabilities response
Section titled “Example capabilities response”{ "status": 200, "data": { "ai": { "enabled": true, "searchSummaryConfigured": true, "llmProviderConfigured": true, "llmModelConfigured": true, "semanticSearchConfigured": true, "intentDetectionModelConfigured": true } }}Federation Capabilities Endpoint
Section titled “Federation Capabilities Endpoint”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.
Example federation capabilities request
Section titled “Example federation capabilities request”curl -H "Authorization: read-key-value" https://searchcraft-cluster-url/federation/4_galaxy_news_test/capabilitiesExample federation capabilities response
Section titled “Example federation capabilities response”{ "status": 200, "data": { "ai": { "enabled": true, "searchSummaryConfigured": true, "llmProviderConfigured": true, "llmModelConfigured": true, "semanticSearchConfigured": true, "intentDetectionModelConfigured": true } }}Search Summary Endpoint
Section titled “Search Summary Endpoint”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.
400 conditions
Section titled “400 conditions”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.
| Condition | Message |
|---|---|
ai_enabled is false | AI features are disabled for this index |
No ai block configured | AI features not configured for this index |
ai exists but no search_summary block | Search summary not configured for this index |
Invalid llm_provider value | Invalid LLM provider |
Payload contains a semantic clause | semantic query clauses are not supported on the summary endpoint |
facet_depth is set to a value other than 1 | facet_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.
Example summary request
Section titled “Example summary request”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/summaryExample event stream
Section titled “Example event stream”event: metadatadata: {"results_count":3,"cached":false}
event: deltadata: {"content":"Top options include..."}
event: donedata: {"results_count":3}Event types
Section titled “Event types”| Event | Payload | Description |
|---|---|---|
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. |
Zero results behaviour
Section titled “Zero results behaviour”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.
Federation Search Summary Endpoint
Section titled “Federation Search Summary Endpoint”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.
Configuration source
Section titled “Configuration source”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.
Permissions
Section titled “Permissions”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.
400/404 conditions
Section titled “400/404 conditions”| Condition | Status | Message |
|---|---|---|
| Federation does not exist | 404 | federation {name} does not exist |
| A member index no longer exists | 404 | index {name} does not exist |
| Federation has no member indexes | 400 | No indexes in federation |
ai_enabled is false on the federation | 400 | AI features are disabled for this federation |
No ai block configured on the federation | 400 | AI features not configured for this federation |
ai exists but no search_summary block | 400 | Search summary not configured for this federation |
Invalid llm_provider value | 400 | Invalid LLM provider |
Payload contains a semantic clause | 400 | semantic query clauses are not supported on the summary endpoint |
facet_depth is set to a value other than 1 | 400 | facet_depth {value} is not supported: ... |
Caching and billing
Section titled “Caching and billing”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.
Example federation summary request
Section titled “Example federation summary request”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/summaryStructured Query Support
Section titled “Structured Query Support”The summary endpoint supports the same structured queries as the standard search endpoint.
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/summaryWhen keyword rules are configured, Searchcraft derives human-readable match text from supported query fragments including fuzzy, exact, dynamic queries.
Keyword Rules
Section titled “Keyword Rules”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.
Matching behaviour
Section titled “Matching behaviour”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".
Rule fields
Section titled “Rule fields”| Field | Description |
|---|---|
replacement_term | When 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_instruction | Appended to the index-level additional_prompt_instructions when the rule matches. |
empty_state_message | Overrides the index-level empty_state_message when the rule matches and the search returns no results. Supports ${searchTopic} placeholder replacement. |
Supported LLM Providers
Section titled “Supported LLM Providers”The summary endpoint works with any LLM provider configured on the index. Supported providers are:
| Provider | llm_provider value | Credential |
|---|---|---|
| AWS Bedrock | bedrock | AWS SDK credential chain (llm_region required) |
| llama.cpp | llamacpp | None (llm_base_url required) |
| Ollama | ollama | None |
| OpenAI | openai | llm_api_key |
| Anthropic | anthropic | llm_api_key |
| Google Gemini | google | llm_api_key |
| xAI (Grok) | xai | llm_api_key |
| Mistral AI | mistral | llm_api_key |
See Optional AI configuration for full configuration examples and field descriptions.