Use filters
Bigtable provides the following types of filters:
- Limiting filters, which control which rows or cells are included in the response.
- Modifying filters, which affect the data or metadata for individual cells.
- Composing filters, which allow you to combine multiple filters into one.
This page describes each Bigtable filter in detail and shows how to use each type of filter using the Cloud Client Libraries. Before you read this page, read Filters.
Additional samples showing how to use filters to read multiple rows of data are available on Reading data.
Data for examples
The examples on this page assume that you're storing time-series data for
smartphones and tablets, and that the following data has been written to a
table. The table has two column families, stats_summary and cell_plan.
Each column family has three columns.
| stats_summary | cell_plan | |||||
|---|---|---|---|---|---|---|
| row key | connected_cell | connected_wifi | os_build | data_plan_01gb | data_plan_05gb | data_plan_10gb |
| phone#4c410523#20190501 | 1 | 1 | PQ2A.190405.003 | true@time minus one hour False @time |
true | |
| phone#4c410523#20190502 | 1 | 1 | PQ2A.190405.004 | true | ||
| phone#4c410523#20190505 | 0 | 1 | PQ2A.190406.000 | true | ||
| phone#5c10102#20190501 | 1 | 1 | PQ2A.190401.002 | true | ||
| phone#5c10102#20190502 | 1 | 0 | PQ2A.190406.000 | true |
Limiting filters
The following sections describe each limiting filter. Limiting filters control which rows or cells are included in the response, based on whether they match specific criteria.
When you use a chain to combine multiple limiting filters, keep in mind that the input row for each filter in the chain is the output row from the previous filter in the chain. For example, if you chain two filters, and the first filter outputs only two of the cells from the original row, the second filter sees only those two cells.
Row selection filters
This section describes the filters that you can use to retrieve rows in a table.
Row sample
This filter lets you retrieve a random sample of rows within a given range. Based on a probability that you specify, the filter chooses at random whether the output row should be the same as the input row or whether it should be omitted from the results.
Go
To learn how to install and use the client library for Bigtable, see Bigtable client libraries.
To authenticate to Bigtable, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
HBase
To learn how to install and use the client library for Bigtable, see Bigtable client libraries.
To authenticate to Bigtable, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
Java
To learn how to install and use the client library for Bigtable, see Bigtable client libraries.
To authenticate to Bigtable, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
Python
To learn how to install and use the client library for Bigtable, see Bigtable client libraries.
To authenticate to Bigtable, set up Application Default Credentials. For more information, see Set up authentication for client libraries.