GOV.UK Search: Introduction and overview
There are two common kinds of public-facing search service on GOV.UK: Site search and Finders.
In addition, there is also the publicly available https://www.gov.uk/api/search.json, powered by search-api. See Using the Search API for examples of how to use this. There is no equivalent publicly available endpoint for querying search-api-v2.
Site search
Site search is available on the GOV.UK homepage and from the blue super navigation header at the top of all gov.uk pages.
The url of site search is https://www.gov.uk/search/all which is rendered by finder frontend, and referred to in code as the all_content finder.
Search results for site search are usually provided by search-api-v2 and Google Cloud Platform (GCP)‘s Agent Search (“Discovery Engine”). Except in the following cases when site search falls back to using search-api
- When no search query is provided.
- When the query param
use_v1=trueis present, eg https://www.gov.uk/search/all?order=updated-newest&use_v1=true - When a world_locations query param is present, eg https://www.gov.uk/search/all?order=updated-newest&world_locations=france
More information is available at GOV.UK Site search: How it works
Finders
Finders are search pages on GOV.UK that are configured to return only a subset of available search results scoped by document type. They are rendered by Finder Frontend, and their search results are provided by search-api.
Some examples:
- https://www.gov.uk/search/news-and-communications
- https://www.gov.uk/search/research-and-statistics
- https://www.gov.uk/government/statistical-data-sets
All finder content items are configured and published from search-api, except for specialist finders which are published by specialist-publisher e.g. https://www.gov.uk/cma-cases (see configuration)
Documentation on how finder frontend queries the two search api applications is available at Finder Frontend: How search works
Search API versus Search API V2
search-api-v2 was built to improve the quality of search results for the majority of GOV.UK users (when compared with search-api) and retains a “minimally compatible” API with search-api. It uses Google Cloud Platform (GCP)’s Agent Search (“Discovery Engine”) product as its underlying search engine.
search-api uses an old version of Elasticsearch as its underlying search engine. There is currently no clear roadmap for retiring search-api.
How content gets into search
Content is published via Publishing API. After an edition is changed, Publishing API publishes a message to the published_documents topic exchange it configured on startup. Interested parties, such as search-api and search-api-v2, subscribe to this exchange to perform post-publishing actions.
search-api and search-api-v2 listen to the publishing queue using the govuk_message_queue_consumer gem. In search-api-v2, PublishingApiMessageProcessor processes the indexing of the content, whereas in search-api, the work is done by MessageProcessor.
In addition to GOV.UK content, GDS staff can insert “external links” into search via Search Admin.
Filtered content
Not all content is indexed into search. For example, currently we only allow documents in English to be added to search, and we ignore particular formats.
The document filtering is part of the message handling functionality in search-api and search-api-v2.
Search Admin
The Search Admin application gives GDS staff a means of inserting “external links” into search. For example, searching for “Complain about bus services - Bus Users” surfaces a link to a non-GOV.UK URL.
As of March 2025, Search Admin is undergoing improvements. Watch this space!
Known limitations
- It isn’t possible to see draft content in search results served by Search API v1 on the draft stack
- Non-English content isn’t supported