DSE Cassandra Decimal Type – Usage and Examples

cassandrasolr

I generated solrschema with dsetool on a table name seriesdata (its key is composed by seriesmetadata_id, initialtime; two decimal field).
These fields are defined as DecimalStrField but they are numeric valued (I have to execute range selection). I tried to change schema defining these fields as:

<fieldType class="org.apache.solr.schema.TrieLongField" name="TrieLongField"/>

but I receive this error:

[cassandra@bigdatalin-03 ~]$ dsetool reload_core timeseriesks.seriesdata schema=schema_data.xml solrconfig=solr_config_data.xml reindex=true -l cassandra -p cassandra
org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: com.datastax.bdp.search.solr.CassandraIndexSchema$ValidationException: Mismatch between Solr key field [seriesmetadata_id] with type {TrieLongField{class=org.apache.solr.schema.TrieLongField,analyzer=org.apache.solr.schema.FieldType$DefaultAnalyzer,args={class=org.apache.solr.schema.TrieLongField}}] and Cassandra key alias [seriesmetadata_id] with type [decimal]
at org.apache.solr.client.solrj.impl.HttpSolrServer.executeMethod(HttpSolrServer.java:665)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:303)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:294)
at com.datastax.bdp.tools.SearchDseToolCommands.createOrReloadCore(SearchDseToolCommands.java:559)
at com.datastax.bdp.tools.SearchDseToolCommands.access$200(SearchDseToolCommands.java:59)
at com.datastax.bdp.tools.SearchDseToolCommands$ReloadCore.execute(SearchDseToolCommands.java:209)
at com.datastax.bdp.tools.DseTool.run(DseTool.java:126)
at com.datastax.bdp.tools.DseTool.run(DseTool.java:51)
at com.datastax.bdp.tools.DseTool.main(DseTool.java:186)

Why?
Thanks a lot!

Best Answer

Since you're using Datastax Enterprise search nodes, solr is integrated with cassandra. What has happened here is that when you changed your solr schema, you did not change the associated cassandra schema. The error message is telling you that there is a mismatch between your new solr schema and the cassandra schema for the same table. Check the cassandra schema for seriesdata and make it consistent with the solr schema.