Identifying the partition key
Restrictions and guidelines for filtering results by partition key when also using a Solr query.
Solr CQL queries support restriction to a single partition key. Partition key restrictions work only when _partitionKey is explicitly indexed or the schema explicitly includes all of the components of the database partition key. In your schema, you can override _partitionKey when not using joins.
SELECT id, date, value FROM keyspace.table WHERE id = 'series1' AND solr_query='value:bar*';
CREATE TABLE vtbl (k1 text, k2 text, value text, PRIMARY KEY (k1, k2));
SELECT * FROM vtbl WHERE k1 = '50' AND solr_query='value:*'
"fq":"k1:50"
:SELECT * FROM valuetable WHERE solr_query='{"q":"value:*", "fq":"k1:50"}'
Restricting nodes queried using the Solr token function
SELECT id, value FROM keyspace.table WHERE token(id) >= -3074457345618258601 AND token(id) <= 3074457345618258603 AND solr_query='id:*'
SELECT id, value FROM keyspace.table WHERE token(id) >= 3074457345618258604 AND solr_query='id:*'
- token() cannot be used with route.range or route.partition
- Wrapping token() ranges are not supported
- A specified token() range must be owned by a single node; ranges cannot span multiple nodes
- Because DSE uses the Solr single-pass queries, only the fields that are declared in the search schema are returned in the query results. If you have columns that do not need to be indexed but still need to be returned by using a token-restricted query, you can declare the columns as stored non-indexed fields in your schema.xml file.
Overriding _partitionKey when not using joins
The special _partitionKey
field is used internally for joins. If you do not plan on using joins, you can
override this field declaration in the schema.xml file for only
the indexed
and docValues
properties.
_partitionKey
field from being indexed, set
indexed
to
false
:<field name="_partitionKey" type="string" indexed="false"/>
_partitionKey
field, set
docValues
to
false
:<field name="_partitionKey" type="string" docValues="false"/>