[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-27。"],[[["\u003cp\u003eFilters in Bigtable refine read requests by limiting the data returned, thus reducing network costs and improving throughput.\u003c/p\u003e\n"],["\u003cp\u003eBigtable filters fall into three categories: limiting filters, which control the inclusion of rows or cells based on criteria; modifying filters, which alter cell data or metadata; and composing filters, which combine multiple filters.\u003c/p\u003e\n"],["\u003cp\u003eLimiting filters can exclude rows or cells based on row keys, column families, timestamps, or values, and many will result in a whole row being excluded if all the cells are excluded.\u003c/p\u003e\n"],["\u003cp\u003eModifying filters, such as the strip value filter and apply label filter, will change the output of a read request by either removing the value of each cell or by adding a label respectively.\u003c/p\u003e\n"],["\u003cp\u003eComposing filters, including chain, interleave, and condition, enable complex filtering by applying multiple filters sequentially, combining results from multiple filters, or conditionally selecting one of two filters.\u003c/p\u003e\n"]]],[],null,["# Filters\n=======\n\nWhen you read data from Bigtable, you can read specific rows or ranges\nof rows. However, you don't always need all of the data in all of the rows. You\nmight only need rows that contain a specific value in their row key, or cells\nwithin a specific column family.\n\nTo limit the results of a read request, include *filters* in the request. A\nfilter is applied to the data before the response is sent, reducing the amount\nof data that is returned. As result, using filters can mean lower network costs\nand faster throughput. This page provides an overview of how\nBigtable filters work and a list of available filters.\n\nFor details and code samples for each filter, see [Filter examples](/bigtable/docs/using-filters).\n\n\n| **Note:** The HBase client for Java uses HBase's filter APIs instead of the Bigtable Data API. To learn about HBase's filter APIs, see the [HBase documentation](https://hbase.apache.org/book.html#client.filter).\n\n\u003cbr /\u003e\n\nHow filters work\n----------------\n\nWhen your read request includes a filter, Bigtable retrieves a row\nor a range of rows from your table. For each of the *input rows* that it\nretrieves, Bigtable evaluates the row using your filter, then\ngenerates an *output row* based on the filter results.\n\nBigtable provides several types of filters, as described in the\nfollowing sections. Basic filters fall under two categories: *limiting* and\n*modifying* . You can combine basic filters into *composing* filters.\n\nIn most cases, a filter is applied to *all rows* unless you specify row key,\nrow range, or number of rows that the filter should be applied to. One exception\nis the [row key regex](/bigtable/docs/using-filters#row-key-regex) filter, which\ncan restrict the row range in certain cases if the regex is a fixed prefix. In\ngeneral, to avoid the slowness of a full table scan, always specify the rows for\na filter.\n\n### Limiting filters\n\nA *limiting filter* controls which rows or cells are included in the response,\nbased on whether they match specific criteria. For example, you can say that\nthe response should include only rows in which the row key matches a regular\nexpression, or that you want only cells from a specific column family.\n\nMany limiting filters can exclude cells from an output row. If all of the cells\nare excluded from an output row, the row is not included in the response.\n\nSee the [Summary of filters](#summary) for a complete list of limiting filters.\n\n### Modifying filters\n\nA *modifying filter* affects the data or metadata for individual cells.\n| **Note:** Modifying filters affect the data that is returned in the read request, *not* the data in the table.\n\nBigtable provides the following modifying filters:\n\n- The [**strip value filter**](/bigtable/docs/using-filters#strip-value), which replaces each cell's value\n with an empty string. This filter is useful when you only need the number of\n rows or the list of row keys that meet your criteria, rather than the data from\n those rows.\n\n- The [**apply label filter**](/bigtable/docs/using-filters#apply-label), which applies a label to each cell\n to identify which filter produced each cell in the response. Your application\n can use these labels to perform additional filtering on the client side.\n\n### Composing filters\n\nA *composing filter* allows you to combine multiple basic filters into one,\nwhich makes it possible to apply more than one filter to a single read request.\nFor example, to get CPU usage data for your servers, you could use one filter to\ninclude only rows where the row key starts with `SERVER`, followed by a second\nfilter to include only cells within the `CPU` column family.\n\nBigtable provides the following composing filters:\n\n- A [**chain**](/bigtable/docs/using-filters#chain), which applies a sequence of filters to each input row and returns an output row. A chain filter is like using a logical AND.\n- An [**interleave**](/bigtable/docs/using-filters#interleave), which sends each input row through multiple filters, then combines all of the filter results for the input row into a single output row. An interleave filter is like using a logical OR.\n- A [**condition**](/bigtable/docs/using-filters#condition), which generates an output row by applying one of two possible filters to the input row. The filter is chosen by applying a predicate filter to the input row, then checking to see whether the predicate filter's output row contains any cells.\n\nFilters and performance\n-----------------------\n\nFilters allow you to retrieve only the data you actually need. As a result,\nfilters can improve performance by reducing the amount of data that is sent to\nyour application.\n\nHowever, filters are not an all-purpose solution to every performance issue. In\ngeneral, filters should be used to control *throughput efficiency* , not to\nreduce the latency between sending a request and receiving a response. Used\ncorrectly, filters can be an effective part of a strategy to [improve read\nperformance](/bigtable/docs/reads#performance).\n\nThe [conditions](/bigtable/docs/using-filters#condition) filter, in particular, can increase latency,\nbecause conditions are much slower than other filters. If your read request is\nextremely performance-sensitive, do not use conditions in the request.\n| **Warning:** Using a regex rowkey filter without also specifying a start, end, prefix, or number of rows results in a full table scan, which can be slow.\n\nSummary of filters\n------------------\n\nThe following tables list the filters that Bigtable provides,\nincluding links to details and code samples for each filter.\n\nWhat's next\n-----------\n\n- [See samples of read requests.](/bigtable/docs/reads)\n- [Explore samples of write requests.](/bigtable/docs/writes)"]]