如何按照cassandra中的日期范围进行搜索?

for e.g

SELECT *
FROM api_call_log
WHERE account_sid='XXXXXXXXXXXX'            AND 
      created_time >= 01-02-2016 00:00:00   AND
      created_time <= 31-02-2016 23:59:59
ALLOW FILTERING

I am getting records from first month as well though I searched for second month.

Try this

SELECT * FROM api_call_log WHERE account_sid='XXXXXXXXXXXX' AND jobs.created_at between '01-02-2016 00:00:00' and '31-02-2016 23:59:59';

And also check the DATE/TIME format of the date column

It's difficult to say without seeing your table structure or relevant portions of your result set. But I did notice that you are not specifying a GMT offset, which means you are effectively querying by your default local offset. The problem, is that Cassandra stores by GMT+0000.

For example, if you have a negative GMT offset of say -0600 (like me), a query for GMT-0600 would miss 6-hours-worth of data from February 1st. For instance, if I have a row out there for 2016-02-01 01:00:00+0000, this query will not return it:

aploetz@cqlsh:stackoverflow> SELECT * FROm events WHERe monthbucket='201602' 
    AND eventdate >= '2016-02-01 00:00:00';

 monthbucket | eventdate | beginend | eventid | eventname
-------------+-----------+----------+---------+-----------

(0 rows)

And that's because 2016-02-01 01:00:00+0000 is essentially 2016-01-31 19:00:00-0600. So if I add the GMT offset of 0000, I see the row.

aploetz@cqlsh:stackoverflow> SELECT * FROm events WHERe monthbucket='201602'
    AND eventdate >= '2016-02-01 00:00:00+0000';

 monthbucket | eventdate                | beginend | eventid                              | eventname
-------------+--------------------------+----------+--------------------------------------+-------------------
      201602 | 2016-02-01 01:00:00+0000 |        b | 78d2c2b7-c4ec-408f-be37-eccc0c05727d | test month border

(1 rows)

My guess, is that you probably have the opposite problem (extra rows vs. missing rows) due to having a positive GMT offset. Not specifying your offset in your query could be why it is including rows from the previous month. And if that's the case, then you may want those rows.

Also, don't use ALLOW FILTERING. Like ever.