Question

I've got a question regarding Apache Cassandra (1.2) working with Apache Solr (as in Datastax Enterprise 3.2.3). I have installed & configured everything as described in the documentation from Datastax, using a CentOS virtual machine, and the basic tests worked fine and as described. However, while testing some custom configurations, I stumbled upon a problem for which I did not found (yet) direct help in the documentation & FAQs:

I'm trying to let Solr work with a Cassandra table which uses compact storage and a compound primary key at the same time. According to the documentation, the latest DSE/Solr is able to understand both and for both examples are shown, but unfortunately not for the combination of both. As for Cassandra, this does not seem to be any problem, but I did not manage to get it to work with Solr:

Here's the table I added to Cassandra:

CREATE TABLE my_table(
myid text,
aa text,
bb text,
cc text,
PRIMARY KEY(myid,aa,bb)
) WITH COMPACT STORAGE;

Here's the essential part of my attempt for a (very basic) Solr-Schema:

<schema name="my_schema" version="1.1">
 <types>
  <fieldType name="string" class="solr.StrField"/>    
 </types>
 <fields>
    <field name="myid" type="string" indexed="true"  stored="true"/>
    <field name="aa" type="string" indexed="true"  stored="true"/>
    <field name="bb" type="string" indexed="true"  stored="true"/>
    <field name="cc" type="string" indexed="true"  stored="true"/>
 </fields>
<uniqueKey>(myid,aa,bb)</uniqueKey>
</schema>

I'm using the solrconfig.xml from the Datastax' Solr getting started tutorial (the "nhanes"-data.) I have not altered it since I did not find any apparent setting linked to this problem.

Everything works fine when omitting "WITH COMPACT STORAGE;", but when I keep it, it results in

org.apache.solr.common.SolrException: Unable to create core

when creating the Solr core, which appears to find its origin in what also the Solr browser interface tells me:

java.io.IOException:java.io.IOException: InvalidRequestException(why:Cannot have key alias equals to a column name: myid).

My questions:

  • Is the described combination (Solr + compound key + compact storage) even possible?
  • if yes: what did I miss?
  • if no: I would be grateful for suggestions to handle this. I need to keep the Cassandra schema accessible via C++/Thrift legacy code and CQL3 at the same time, i.e., compact storage appears to be inevitable. The actual original data schema featured super columns, which I tried to mimic by using the compound key.

Thanks a lot for you time!

Was it helpful?

Solution

Unfortunately, compact storage with compound primary keys is not actually supported by DSE Search (the error is pretty obscure and we'll look into improving this).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top