Search code examples
solrcassandradatastaxdatastax-enterprise

Error creating search index in SolR - Cassandra integration (DSE)


I have a table in DSE cassandra instance with following fields,

customerid uuid,
emailaddress text,
firstname text,
lastname text
PRIMARY KEY is on (customerid, emailaddress)

i have defined schema.xml as below,

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<schema name="customer" version="1.5">
<types>
        <fieldType class="org.apache.solr.schema.TextField" name="TextField">
                <analyzer>
                        <tokenizer class="solr.StandardTokenizerFactory"/>
                        <filter class="solr.LowerCaseFilterFactory"/>
                </analyzer>
        </fieldType>
        <fieldType class="solr.StrField" name="StrField"/>
        <fieldType class="solr.TrieIntField" name="int"/>
        <fieldType class="solr.UUIDField" name="uuid"/>
</types>
<fields>
        <field indexed="true" multiValued="false" name="emailaddress" stored="true" type="TextField"/>
        <field indexed="true" multiValued="false" name="customerid" stored="true" type="uuid"/>
        <field indexed="true" multiValued="false" name="lastname" stored="true" type="TextField"/>
</fields>
<uniqueKey>customerid</uniqueKey>
</schema>

When trying to create core on the command line i'm getting following exception,

$ curl -u db_admin:test123 "http://localhost:8983/solr/admin/cores?action=CREATE&name=ks_01.customer"

"...<str name="msg">com.datastax.bdp.search.solr.CassandraIndexSchema$ValidationException: Clustering parts that are not part of the unique key must be multi-valued.</str><str name="trace">org.apache.solr.common.SolrException: com.datastax.bdp.search.solr.CassandraIndexSchema$ValidationException: Clustering parts that are not part of the unique key must be multi-valued....."

can someone suggest what i'm missing here with some detailed explanation. thank you.


Solution

  • I know nothing about DSE but it seems to me you made a syntax mistake[1] :

    <uniqueKey>customerid</uniqueKey> 
    

    should be

    <uniqueKey>(customerid, emailaddress)</uniqueKey>
    

    [1] http://docs.datastax.com/en/datastax_enterprise/4.8/datastax_enterprise/srch/srchConfSkema.html