How to combine filters in Hbase shell?
This question was asked long back, but just in case it helps someone...
I have tried combining prefixfilter and SingleColumnValueFilter like below and it works as expected:
scan 'dbtest:table1', {FILTER => "(PrefixFilter ('abc') AND SingleColumnValueFilter('cf','age',>=, 'binary:10',true,false)"}
Here
- dbtest is my namespace, if its default for you then you can skip
- cf is my column family
- age is a column
- This should result in rows having 'abc' as prefix and 'cf:age' column value >= 10
This link should help understand the filters better
Using only SingleColumnValueFilter
scan 'table', {FILTER => "SingleColumnValueFilter ('columnfamily', 'columnname', =, 'binary:value', true, false) AND SingleColumnValueFilter('columnfamily', 'columnname', =, 'binary:value', true, false)"}
Replace following fields,
table - hbase table name ex: hbaseTemp
columnfamily - hbase column family name ex: s
columnname - hbase column name ex: id
value - hbase field value ex: 12343
Docx for SingleColumnValueFilter: https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/filter/SingleColumnValueFilter.html