我有一个列系列,其中包含timeuuid作为列的id(它是时间序列)以及构成分区键的其他几列。它还包含未分类的列,其中包含应该可搜索的数据(通过solr)。
CREATE TABLE events (
unique_serial bigint,
time_period int,
event_id timeuuid,
search_field_1 int,
search_field_2 double,
search_field_3 double,
summary text,
data text,
PRIMARY KEY((unique_serial, time_period), event_id)
) WITH CLUSTERING ORDER BY (event_id DESC);
我的solr架构如下所示:
<schema name="events" version="1.1">
<types>
<fieldType name="string" class="solr.StrField"/>
<fieldType name="long" class="solr.LongField" />
<fieldType name="double" class="solr.DoubleField" />
<fieldType name="int" class="solr.IntField" />
<fieldType name="text" class="solr.TextField">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
</analyzer>
</fieldType>
<fieldType name="uuid" class="solr.UUIDField" />
</types>
<fields>
<field name="unique_serial" type="long" indexed="true" stored="true"/>
<field name="time_period" type="int" indexed="false" stored="true" />
<field name="event_id" type="uuid" indexed="true" stored="true" />
<field name="search_field_1" type="int" indexed="true" stored="true"/>
<field name="search_field_2" type="double" indexed="true" stored="true"/>
<field name="search_field_3" type="double" indexed="true" stored="true"/>
<field name="summary" type="text" indexed="true" stored="true" />
</fields>
<defaultSearchField>summary</defaultSearchField>
<uniqueKey>(unique_serial,time_period,event_id)</uniqueKey>
</schema>
当我尝试创建solr核心时,我收到此错误:
Caused by: java.lang.IllegalStateException: Mismatch between Solr key field event_id with type uuid{class=org.apache.solr.schema.UUIDField,analyzer=org.apache.solr.schema.FieldType$DefaultAnalyzer,args={class=solr.UUIDField}} and Cassandra key alias event_id with type timeuuid
at com.datastax.bdp.search.solr.core.Cql3CassandraSolrSchemaUpdater.validateUniqueKeyStructure(Cql3CassandraSolrSchemaUpdater.java:235)
at com.datastax.bdp.search.solr.core.Cql3CassandraSolrSchemaUpdater.update(Cql3CassandraSolrSchemaUpdater.java:47)
at com.datastax.bdp.search.solr.core.CassandraCoreContainer.create(CassandraCoreContainer.java:244)
... 29 more
如果我将event_id更改为UUID然后它可以工作,但我想保持event_id排序的行。根据文档,如果UUID都是版本1,UUID将执行此操作,但我喜欢timeuuid如何明确时间的重要性并强制执行版本1.
也许我误解了datastax文档,但我认为timeuuid得到了支持(http://www.datastax.com/documentation/datastax_enterprise/4.0/datastax_enterprise/srch/srchSolrType.html)
答案 0 :(得分:0)
看起来像是由“CLUSTERING ORDER BY”指令引起的错误,请在没有它的情况下尝试让我们知道。