API Design
Search API Response JSON Example
A real-world JSON example of a search API response in the style of Algolia and Elasticsearch — including hit scoring, highlighted snippets, faceted filters, and pagination metadata.
Field Reference
queryrequiredstringThe search query string submitted by the user.tookrequirednumberTime in milliseconds the search engine took to execute.totalHitsrequirednumberTotal matching documents before pagination.hits[].scorerequirednumber (0–1)Relevance score — higher means more relevant to the query.hits[].highlightoptionalobjectFields with query terms wrapped in <em> tags for UI highlighting.facetsoptionalobjectAggregated filter options with counts for each selectable value.facets.<name>[].valuerequiredstringFilter option identifier shown in the UI.facets.<name>[].countrequirednumberNumber of results that match this filter value.Variants
No resultsEmpty search response — useful for handling the zero-results state in UI
Common Use Cases
- →Building a product search page with faceted filtering and sorting
- →Mocking a search API for frontend development without an Elasticsearch cluster
- →Implementing keyboard-navigable search result UIs with highlighted terms
- →Designing the schema for a search microservice response contract
- →Testing zero-results, single-result, and paginated result states
searchAlgoliaElasticsearchfacetsfull-text searchAPI
Validate or format this JSON
One click loads this exact example into the tool — no copy-paste needed. Format it, validate it, explore the tree, or generate TypeScript types instantly.
Frequently Asked Questions
Related JSON Examples
API DesignPagination ResponsePaginated list response JSON with offset, cursor, total, and navigation links.API DesignREST API ResponseGeneric REST API response wrapper with data payload, status, and pagination meta.AI & LLMEmbedding Vector ResponseEmbeddings API response with the vector array, model, and usage.