This page refers to the
suggestions
parameter that is part of a view.
suggestions
can also be used as part of a dimension or filter field, described on thesuggestions
(for fields) parameter documentation page.
Usage
view: view_name { suggestions: yes }
Hierarchy
suggestions |
Default Value
yes
Accepts
A Boolean (yes or no )
|
Definition
In an Explore, when a user filters a query on a dimension of type: string
, Looker can provide suggestions in the filter value text box as the user types. Looker provides the dimension's possible values from the database and suggests the possible values based on what the user has typed in the text box. Suggestions are supported only for dimensions of type: string
and are on by default for most dialects. You can add the suggestions: no
statement to a view
definition to disable filter value suggestions for all the type: string
dimensions in the view.
For some dialects, such as Amazon Athena, Qubole Presto, Trino, Cloudera Impala, Apache Hive, and Apache Spark, providing suggestions requires querying the database, which may be expensive. Because of this, if you use Looker to automatically generate a project from your database for these dialects, Looker will create the views with the
suggestions: no
declaration.
Example
Here is an example view where suggestions are disabled for all dimensions of type: string
:
view: aircraft_types {
sql_table_name: flightstats.aircraft_types ;;
suggestions: no
...
}
Things to know
suggestions
at the view level works differently than suggestions
at the dimension level
The suggestions
parameter described on this page is applied to a view and works differently than the suggestions
parameter applied to a dimension. When applied at the dimension level, suggestions
lets you hard-code a list of suggestions for that dimension.
If you want to disable suggestions for an individual type: string
dimension, you can use the suggestable: no
statement for the dimension.
You can disable suggestions for individual dimensions
If you want to disable suggestions for an individual type: string
dimension, you can add the suggestable: no
statement to the dimension's definition instead of using suggestions: no
for the entire view. The inverse doesn't work, however: you cannot define a view with suggestions: no
and then use the suggestable: yes
statement to enable suggestions for individual type: string
dimensions in the view. The behavior is set up this way because, if a developer is specifying suggestions: no
at the view level, the developer wants to prevent expensive queries on the database for that view, so suggestions should be kept off for all dimensions in the view.
As an alternative, for a view with suggestions: no
, you can use the suggestions
parameter for individual type: string
dimensions to hard-code possible values for a filter even if the dimension's view has the suggestions: no
statement, since hard-coded values do not require a query on the database.