问题
Is it possible to perform a MultigetSliceQuery while using conditions on indexed columns like with a IndexedSlicesQuery. In other words, an IndexedSlicesQuery performed on a specific set of keys.
The way I found to do this is by first performing a MultigetSliceQuery on a set of keys and then filter the results in the application code. But can Cassandra do it for me?
回答1:
No, the only options for IndexedSlicesQuery are setting the startKey and rowCount, so 2 phased filter would be the only way.
A couple of options to look at: add another secondary index and include that in the indexed query, use of composite keys and/or columns in the existing column family, or a new column family with keys or columns which refer to the original keys.
Might result is more than one query (to one or more column family), but Cassandra will be doing the heavy lifting.
来源:https://stackoverflow.com/questions/8448911/cassandra-hector-how-to-do-a-multigetslicequery-with-indexed-columns