/search
GET
Default ONS query API which combines the content with type counts
Parameters
Name | Type | Description |
---|---|---|
q | query | Query search term. |
content_type | query | Comma-separated list of content types to be returned. |
topics | query | Comma-separated list of topics to be returned. |
population_types | query | Comma-separated list of population type names to filter the results (or). |
dimensions | query | Comma-separated list of dimension names to filter the results (and). |
cdids | query | Comma-separated list of cdids to filter the results (or). |
dataset_ids | query | Comma-separated list of dataset IDs to filter the results. |
highlight | query | Determines whether to return HTML highlighted fields. |
sort | query | The order to return the results. |
limit | query | The number of items requested, defaulted to 10 and limited to 1000. |
offset | query | The first row of resources to retrieve, starting at 0. Use this parameter as a pagination mechanism along with the limit parameter. |
fromDate | query | Specifies candidate results by their ReleaseDate, which must be on or after the fromDate |
toDate | query | Specifies candidate results by their ReleaseDate, which must be on or before the toDate |
nlp_weighting | query | Runs query through NLP processors to influence search weighting |
uri_prefix | query | URI prefix to filter the search results e.g. `/economy` |
Responses
200: OK
Example value
{
"type": "object",
"required": [
"count",
"took",
"distinct_items_count",
"content_types",
"items"
],
"properties": {
"additional_suggestions": {
"description": "List of suggested alternative search queries from current search query",
"type": "array",
"items": {
"type": "string"
},
"example": [
"UK",
"economy",
"inflation rate"
]
},
"content_types": {
"description": "List of content types included in results",
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"count"
],
"properties": {
"count": {
"type": "integer"
},
"type": {
"type": "string"
}
}
}
},
"count": {
"description": "Number of search results which match query",
"type": "number",
"example": 80
},
"dimensions": {
"description": "List of dimensions included in results",
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"count"
],
"properties": {
"count": {
"type": "integer"
},
"type": {
"type": "string"
}
}
}
},
"distinct_items_count": {
"description": "Count of distinct items that match the query",
"type": "integer",
"example": 100
},
"items": {
"description": "List of matching content items for the current page",
"type": "array",
"items": {
"type": "object",
"required": [
"description",
"type",
"uri"
],
"properties": {
"description": {
"type": "object",
"required": [
"summary",
"title"
],
"properties": {
"contact": {
"type": "object",
"required": [
"name",
"email"
],
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string"
},
"telephone": {
"type": "string"
}
}
},
"dataset_id": {
"type": "string"
},
"dimensions": {
"description": "An array of dimensions within a dataset.",
"type": "array",
"items": {
"type": "object",
"properties": {
"label": {
"type": "string"
},
"name": {
"type": "string"
},
"raw_label": {
"type": "string"
}
}
}
},
"edition": {
"type": "string"
},
"headline1": {
"type": "string"
},
"headline2": {
"type": "string"
},
"headline3": {
"type": "string"
},
"highlight": {
"description": "Fields that contain at least 1 matching term from query 'q' parameter. The values contain the following embedded tags \"...\u003cem class=\"highlight\"\u003e{matched term}\u003c/em\u003e...\"",
"type": "object",
"properties": {
"keywords": {
"type": "array",
"items": {
"type": "string"
}
},
"summary": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"keywords": {
"type": "array",
"items": {
"type": "string"
}
},
"language": {
"type": "string",
"example": "English"
},
"latest_release": {
"type": "boolean"
},
"meta_description": {
"type": "string"
},
"national_statistic": {
"type": "boolean"
},
"next_release": {
"type": "string",
"example": "14 August 2015"
},
"population_type": {
"description": "A population type a dataset is associated with e.g. Usual-Residents. This is applicable to Census 2021 datasets only.",
"type": "string"
},
"pre_unit": {
"type": "string"
},
"release_date": {
"type": "string",
"format": "date-time"
},
"source": {
"type": "string"
},
"summary": {
"type": "string"
},
"title": {
"type": "string"
},
"topics": {
"type": "array",
"items": {
"type": "string"
}
},
"unit": {
"type": "string"
}
}
},
"type": {
"type": "string"
},
"uri": {
"type": "string"
}
}
}
},
"population_type": {
"description": "List of population types included in results",
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"count"
],
"properties": {
"count": {
"type": "integer"
},
"type": {
"type": "string"
}
}
}
},
"suggestions": {
"description": "List of suggested alternative similar search queries",
"type": "array",
"items": {
"type": "string"
}
},
"took": {
"description": "Time taken to execute query in milliseconds",
"type": "number",
"example": 530
},
"topics": {
"description": "List of topics included in results",
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"count"
],
"properties": {
"count": {
"type": "integer"
},
"type": {
"type": "string"
}
}
}
}
}
}
400: Query term not specified
Example value
null
500: Internal server error
Example value
null
POST
Request a new search index and receive the name of the new index created in response. Endpoint requires service or user authentication.
Responses
200: OK
Example value
{
"type": "object",
"required": [
"index_name"
],
"properties": {
"index_name": {
"description": "Name of new empty search index",
"type": "string",
"example": "ons1636458168532"
}
}
}
500: Internal server error
Example value
null