Changing filter suggestions

This page provides an overview of LookML parameters that affect filter suggestions. This page lists each parameter with a link to its full reference page, a short description of its function, and an image of what it does.

Default behavior

By default, in a Look or an Explore, when a user enters a filter value for a dimension of type: string, Looker suggests options that match what the user enters. On a dashboard, if the dashboard filter is filtering on a field of type: string, Looker also suggests filter options. These filter suggestions are created using a SELECT DISTINCT query on the dimension, so the suggestions will only return values that match existing data for that field:

Filter suggestions appear in a drop-down menu that is revealed when a user selects the filter value field.

If you experience any unexpected behavior and need to troubleshoot filter suggestions, see the Troubleshooting common filter suggestion issues Best Practices page.

Enabling or disabling filter suggestions

This section describes the following LookML parameters that let you enable or disable filter suggestions:

suggestable (field)

Setting suggestable to no lets you disable suggestions for a dimension or filter. The default value of suggestable is yes, so Looker provides suggestions to the user when possible. If you set suggestable to no instead, Looker does not make suggestions.

suggestions (view)

Setting suggestions to no lets you disable suggestions for all the dimensions in a view. The default value of suggestions is yes, so Looker provides suggestions to the user when possible. If you set suggestions to no instead, Looker does not make suggestions.

Filter suggestion values

This section describes the following LookML parameters that let you set or restrict the values shown in filter suggestions:

allowed_value (field)

allowed_value works with the parameter LookML parameter. If a Looker developer provides a parameter filter-only field, the values entered or selected by users can be referenced using a {% parameter %} Liquid variable. Optionally, you can use allowed_value to define a list of values a user can choose for that parameter field.

allowed_value has two subparameters, label and value. The label subparameter specifies the options the user will see in the filter suggestions. The value subparameter contains the values that are passed to the {% parameter %} Liquid variable.

For example, a parameter may be defined as follows:

parameter: order_amount {
  type: string
  allowed_value: {
    label: "Less than $50"
    value:"< 50"
  }
  allowed_value: {
    label: "Between $50 and $100"
    value:"<= 100"
  }
  allowed_value: {
    label: "Over $100"
    value:"> 100"
  }
}

Then, when a user filters on the parameter, they can choose from the options Less than $50, Between $50 and $100, and Over $100.

For more information, see this section of the parameter reference page.

bypass_suggest_restrictions (field)

bypass_suggest_restrictions enables filter suggestions in situations where they would otherwise be disabled or limited. If you have used sql_always_where or access_filter to restrict the rows users can see, then Looker also restricts the filter suggestions to the values in the permitted rows. However, if you're certain that there are no possible values in a particular dimension or filter field that would reveal sensitive information, you can use bypass_suggest_restrictions to reinstate the full set of filter suggestions.

case (field)

case enables you to bucket a dimension's results with case logic. This impacts filter suggestions because only the values defined in the case statement are shown as filter suggestions for that dimension.

The suggestions presented to a user for a dimension using case will not be restricted when using full_suggestions. Any option that you include in a case parameter will be visible to all users.

A dimension that uses case can be used with linked filters, if the dimension is used in the filter that is updating the other filter. A dimension that uses case cannot be used in the filter that is being updated.

full_suggestions (field)

When full_suggestions is set to no, it disables filter suggestions for a dimension.

The suggestions presented to a user for a dimension using case will not be restricted when using full_suggestions. Any option that you include in a case parameter will be visible to all users.

suggest_dimension (field) and suggest_explore (field)

Looker typically generates filter suggestions by executing a SELECT DISTINCT query on the filter field. For some large tables this query can be too slow or create too large a database load. You can use suggest_dimension to make Looker query an alternative dimension for filter suggestions, in combination with suggest_explore if that dimension lives in a different Explore.

suggestions (field)

suggestions lets you hard-code a list of possible filter suggestion values. This can be useful if you do not want certain data values in a field to appear as suggestions, and instead want to specify a more limited list.

Caching filter suggestions

This section describes the suggest_persist_for parameter, which lets you configure the length of time that filter suggestions are cached.

If you want to reduce the load on your database and the number of data values for a dimension is very high, consider using a parameter to disable filter suggestions for your dimension. If you want filter suggestions to appear, consider using a parameter to limit the filter values that are queried or to hard-code the appropriate options.

suggest_persist_for (field)

By default, filter suggestions are cached for 6 hours, resulting in the same list of suggestions for that length of time. The suggest_persist_for parameter enables you to change how long filter suggestions are cached.