0
votes

The structure of my column family is something like

CREATE TABLE product (
    id UUID PRIMARY KEY,
    product_name text, 
    product_code text,
    status text,//in stock, out of stock
    mfg_date timestamp,
    exp_date timestamp

);

Secondary Index is created on status, mfg_date, product_code and exp_date fields.

I want to select the list of products whose status is IS (In Stock) and the manufactured date is between timestamp xxxx to xxxx.

So I tried the following query.

SELECT * FROM product where status='IS' and mfg_date>= xxxxxxxxx and mfg_date<= xxxxxxxxxx LIMIT 50 ALLOW FILTERING;

It throws error like No indexed columns present in by-columns clause with "equals" operator.

Is there anything I need to change in the structure? Please help me out. Thanks in Advance.

2

2 Answers

0
votes

cassandra is not supporting >= so you have to change the value and have to use only >(greater then) and <(lessthen) for executing query.

0
votes

You should have at least one "equals" operator on one of the indexed or primary key column fields in your where clause, i.e. "mfg_date = xxxxx"