首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Lucidworks保存solr格式未知字段

Lucidworks保存solr格式未知字段
EN

Stack Overflow用户
提问于 2017-04-12 13:54:43
回答 1查看 458关注 0票数 3

我正在用spark做一个脚本。我需要将数据(来自DataFrame)插入到Solr集合中,使用Lucidworks -spark工具(https://github.com/lucidworks/spark-solr)。

我的schema.xml:

代码语言:javascript
复制
<schema name="MY_NAME" version="1.6">
    <field name="_version_" type="long" indexed="true" stored="true" />
    <field name="_root_" type="string" indexed="true" stored="false" />
    <field name="ignored_id" type="ignored" />
    <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="age" type="int" indexed="true" stored="true" required="false" multiValued="false" />
    <field name="height" type="tlong" indexed="true" stored="true" required="false" multiValued="false" />
    <field name="name " type="string" indexed="true" stored="true" required="false" multiValued="false" />

    <fieldType name="string" class="solr.StrField" sortMissingLast="true" />
    <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0" />
    <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0" />
    <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0" />
    <fieldType name="ignored" stored="false" indexed="false" multiValued="true" class="solr.StrField" />

    <uniqueKey>id</uniqueKey>
</schema>

我的DataFrame:

代码语言:javascript
复制
DataFrame df = sqlContext.sql("SELECT id, age, height, name FROM TABLE");

df.show()给出:

代码语言:javascript
复制
+--------------------+-----------+------+------+
|                  id|        age|height|name |
+--------------------+-----------+------+------+
|12345678912345678...|         10|   101|hello|

但是,当我尝试在solr集合中插入以下内容时:

代码语言:javascript
复制
df.write()
.format("solr")
.option("collection", MY_COLLECTION)
.option("zkhost", MY_ZKHOST)
.save()

我有以下错误:

代码语言:javascript
复制
Caused by: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://MY_IP/solr/MY_COLLECTION_SHARD_REPLICA: ERROR :[doc=123456789123456789] unknown field '_indexed_at_tdt'

我不明白"_indexed_at_tdt“是从哪里来的。

对于我想要插入的4个字段,DataFrame似乎是正确的,但是由于这个未知的字段"_indexed_at_tdt“,我仍然无法在Solr集合中插入。

更多信息:我有一个HBase索引,它插入在同一个集合中,并且正在工作。

提前感谢您的帮助!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-04-12 15:14:54

正如您可以看到的那样,这里似乎是由Lucidworks代码自动添加的。

您只需将通讯器字段添加到模式中,它就能工作了:

代码语言:javascript
复制
<field name="_indexed_at_tdt" type="tdate" indexed="true" stored="true" required="false" multiValued="false" />

或者,如果您想让它对*_tdt是动态的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43371613

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档