solrcassandracqldatastax-enterprisesolr-query-syntax

CQL solr-query getting error - cannot pass json query


I'm new to DSE. Working on DSE based queries to get date range

1) select count(1) from tbl where solr_query='code:maf'; It gives the result.

But When I'am trying to use range query is gives error :-

select count(1) from tbl where solr_query='{q:dt:[ 2017-11-15T10:12:10 TO 2017-11-15T12:10:10Z] }';

Error :- Invalid Request: Error from Server: Code:2200 [Invalid Query] message="Cannot pass JSON query" '{q:dt:[ 2017-11-15T10:12:10 TO 2017-11-15T12:10:10Z] }'

Where I'am going wrong? Please help

Thanks,


Solution

  • you need correctly format your query - it should be JSON inside, like this:

    select count(1) from tbl where 
      solr_query='{"q":"dt:[ 2017-11-15T10:12:10 TO 2017-11-15T12:10:10Z]"}';
    

    See official documentation for detailed description.