Using the Cassandra python driver mapper, cqlengine, when creating a model with a map collection it seems it is only possible to create an Index on the map values
class Foo(Model):
id = columns.UUID(partition_key=True)
time_id = columns.UUID(primary_key=True, clustering_order='DESC')
bar = columns.Map(columns.Ascii(), columns.Double(), index=True)
will result in a table like
cqlsh:baz> DESCRIBE foo;
CREATE TABLE bar.asset_metric (
id uuid,
time_id timeuuid,
bar map<ascii, double>,
PRIMARY KEY (id, time_id)
) WITH CLUSTERING ORDER BY (time_id DESC)
CREATE INDEX index_foo_bar ON baz.foo (values(bar));
How do you make cqlengine create the index on the map keys instead?