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
querystringrequiredThe search query string submitted by the user.tooknumberrequiredTime in milliseconds the search engine took to execute.totalHitsnumberrequiredTotal matching documents before pagination.hits[].scorenumber (0–1)requiredRelevance score — higher means more relevant to the query.hits[].highlightobjectoptionalFields with query terms wrapped in <em> tags for UI highlighting.facetsobjectoptionalAggregated filter options with counts for each selectable value.facets.<name>[].valuestringrequiredFilter option identifier shown in the UI.facets.<name>[].countnumberrequiredNumber 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
Paste the example above into JSONKit's tools to validate, minify, or explore the structure interactively.
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.E-commerceProduct ListingE-commerce product JSON with pricing, variants, images, and inventory fields.