Retrieve suggested values for searches on a given field

get/search/suggestions
Internal-Use Only

Get search suggestions for a given field in one or more of the indices provided. Suggestions are only available for fields with a keyword representation or both a text and keyword representation. Any other representations are not supported, and an error will be returned. The suggested values will be unique, and the most common values in the given field in the indices provided. Optionally a parameter q can be provided that acts as a prefix requirement for the values. This endpoint does not support the usual start parameter; pagination is not supported. The limit parameter serves to restrict the number of suggestions that are returned.

Request Samples

1

Response Samples

1{
2 "version": 2,
3 "accept": "text/plain",
4 "start": 0,
5 "limit": 10,
6 "name": "suggestions",
7 "items": [
8 "none",
9 "approved",
10 "review",
11 "flagged",
12 "warning",
13 "other"
14 ],
15 "links": [
16 {
17 "method": "GET",
18 "rel": "collection",
19 "href": "/catalog/search/suggestions",
20 "uri": "/catalog/search/suggestions",
21 "type": "application/vnd.sas.collection",
22 "itemType": "text/plain"
23 },
24 {
25 "method": "GET",
26 "rel": "self",
27 "href": "/catalog/search/suggestions?start=0&limit=10",
28 "uri": "/catalog/search/suggestions?start=0&limit=10",
29 "type": "application/vnd.sas.collection",
30 "itemType": "text/plain"
31 },
32 {
33 "method": "GET",
34 "rel": "up",
35 "href": "/catalog/search",
36 "uri": "/catalog/search",
37 "type": "application/vnd.sas.metadata.search.collection"
38 }
39 ]
40}

Query Parameters

NameTypeRequiredDescription
index(Deprecated)
array [string]
false

The index or indices to search. If multiple indices are specified, the index names must be separated with commas. This field is deprecated - please use indices instead.

Default:
catalog
indices
array [string]
false

The index or indices to search. If multiple indices are specified, the index names must be separated with commas.

Default:
catalog
facet
string
true

A pattern to use when matching the facet name of a suggestion. The facet is required to have a keyword representation, otherwise no suggestions will be returned.

field(Deprecated)
string
true

A pattern to use when matching the field name of a suggestion. The field is required to have a keyword representation, otherwise no suggestions will be returned. This parameter is deprecated - please use facet instead.

limit
integer
false

Maximum number of objects to return. Defaults to 10.

q
string
false

A prefix to search values of the given field.

Header Parameters

NameTypeRequiredDescription
Accept
string
false

The desired representation for the response.

Allowed values:
application/vnd.sas.collection+jsonapplication/json
Default:
application/vnd.sas.collection+json
Accept-Item
string
false

The desired item representation for collections.

Allowed value:
text/plain
Default:
text/plain

Responses

StatusMeaningDescription
200OKOK.HeadersSchema
400Bad RequestBad request (the request is not well-formed).Schema
401UnauthorizedNot authenticated.Schema
403ForbiddenThe user does not have permission to complete this request.Schema
404Not FoundThe Catalog service is not available.Schema
406Not AcceptableNot Acceptable. Include an Accept header with a supported value on the request.Schema
502Bad GatewayBad Gateway: The catalog service was unable to interact with the search engine. More details may be available in the error object.Schema