Solr 嵌套架构
我正在尝试在 Solr 中索引嵌套文档,但它不接受动态字段并以 HTTP 400 响应“SolrError:Solr 响应错误(HTTP 400):[原因:错误: [doc=bcb8eccb1f57f135785347a7e229e2aeb83ee07ddc5ad0e1b1b403a13cce2911]未知字段'aggre_base_on_s'] ”。
Solr schema.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!-- ## Fields definition -->
<!-- Base fields -->
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="_version_" type="plong" indexed="false" stored="false" multiValued="false" docValues="true"/>
<uniqueKey>id</uniqueKey>
<!-- ## Nested documents -->
<field name="_root_" type="string" indexed="true" stored="true" docValues="false" />
<fieldType name="nest_path" class="solr.NestPathField" />
<field name="_nest_path_" type="nest_path" stored="true"/>
<field name="doc_type" type="string" multiValued="false" indexed="true" required="true" stored="true" />
<fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
<fieldType name="plong" class="solr.LongPointField"/>
<fieldType name="date" class="solr.DatePointField"/>
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" multiValued="false"/>
<fieldtype name="binary" class="solr.BinaryField"/>
<fieldType name="int" class="solr.IntPointField"/>
<fieldType name="float" class="solr.FloatPointField"/>
<fieldType name="long" class="solr.LongPointField"/>
<fieldType name="double" class="solr.DoublePointField"/>
<fieldType name="text_ws" class="solr.TextField" omitNorms="true" sortMissingLast="true"/>
<!--
Dynamic field definitions. If a field name is not found, dynamicFields
will be used if the name matches any of the patterns. RESTRICTION: the
glob-like pattern in the name attribute must have a "*" only at the start
or the end. EXAMPLE: name="*_i" will match any field ending in _i (like
myid_i, z_i) Longer patterns will be matched first. if equal size
patterns both match, the first appearing in the schema will be used.
-->
<dynamicField name="*_i" type="int" indexed="true" stored="true"/>
<dynamicField name="*_mi" type="int" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_s" type="string" indexed="true" stored="true"/>
<dynamicField name="*_ms" type="string" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_l" type="long" indexed="true" stored="true"/>
<dynamicField name="*_ml" type="long" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_t" type="text_ws" indexed="true" stored="true" multiValued="false"/>
<dynamicField name="*_mt" type="text_ws" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
<dynamicField name="*_mb" type="boolean" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_f" type="float" indexed="true" stored="true"/>
<dynamicField name="*_mf" type="float" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_d" type="double" indexed="true" stored="true"/>
<dynamicField name="*_md" type="double" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
<dynamicField name="*_mdt" type="date" indexed="true" stored="true" multiValued="true"/>
I am trying to index nested document in Solr, but it is not accepting dynamic field and responded with HTTP 400 as "SolrError: Solr responded with an error (HTTP 400): [Reason: ERROR: [doc=bcb8eccb1f57f135785347a7e229e2aeb83ee07ddc5ad0e1b1b403a13cce2911] unknown field 'aggre_base_on_s']
".
Below is my structure of Json:
Solr schema.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!-- ## Fields definition -->
<!-- Base fields -->
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="_version_" type="plong" indexed="false" stored="false" multiValued="false" docValues="true"/>
<uniqueKey>id</uniqueKey>
<!-- ## Nested documents -->
<field name="_root_" type="string" indexed="true" stored="true" docValues="false" />
<fieldType name="nest_path" class="solr.NestPathField" />
<field name="_nest_path_" type="nest_path" stored="true"/>
<field name="doc_type" type="string" multiValued="false" indexed="true" required="true" stored="true" />
<fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
<fieldType name="plong" class="solr.LongPointField"/>
<fieldType name="date" class="solr.DatePointField"/>
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" multiValued="false"/>
<fieldtype name="binary" class="solr.BinaryField"/>
<fieldType name="int" class="solr.IntPointField"/>
<fieldType name="float" class="solr.FloatPointField"/>
<fieldType name="long" class="solr.LongPointField"/>
<fieldType name="double" class="solr.DoublePointField"/>
<fieldType name="text_ws" class="solr.TextField" omitNorms="true" sortMissingLast="true"/>
<!--
Dynamic field definitions. If a field name is not found, dynamicFields
will be used if the name matches any of the patterns. RESTRICTION: the
glob-like pattern in the name attribute must have a "*" only at the start
or the end. EXAMPLE: name="*_i" will match any field ending in _i (like
myid_i, z_i) Longer patterns will be matched first. if equal size
patterns both match, the first appearing in the schema will be used.
-->
<dynamicField name="*_i" type="int" indexed="true" stored="true"/>
<dynamicField name="*_mi" type="int" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_s" type="string" indexed="true" stored="true"/>
<dynamicField name="*_ms" type="string" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_l" type="long" indexed="true" stored="true"/>
<dynamicField name="*_ml" type="long" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_t" type="text_ws" indexed="true" stored="true" multiValued="false"/>
<dynamicField name="*_mt" type="text_ws" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
<dynamicField name="*_mb" type="boolean" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_f" type="float" indexed="true" stored="true"/>
<dynamicField name="*_mf" type="float" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_d" type="double" indexed="true" stored="true"/>
<dynamicField name="*_md" type="double" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
<dynamicField name="*_mdt" type="date" indexed="true" stored="true" multiValued="true"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现配置未重新加载因此缺少动态字段的问题。
I found the issue with config not being reloaded therefore missing dynamic field.