0

我浏览了这个链接,并在其中一个核心中添加了代码以上传多级 JSON,它运行良好,但是当我创建另一个核心并添加相同的核心时,它会引发以下错误。我花了很多时间来解决这个错误,但没有运气。错误是,

{
  "responseHeader":{
    "status":400,
    "QTime":93},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"ERROR: [doc=5b62d25] unknown field '_src_'",
    "code":400}}

我在我的 solrconfig.xml 文件中添加了以下代码。

<initParams path="/update/json/docs">
  <lst name="defaults">
    <!-- this ensures that the entire JSON doc will be stored verbatim into one field -->
    <str name="srcField">_src_</str>
    <!-- This means a the uniqueKeyField will be extracted from the fields and
         all fields go into the 'df' field. In this config df is already configured to be 'text'
     -->
    <str name="mapUniqueKeyOnly">true</str>
    <!-- The default search field where all the values are indexed to -->
    <str name="df">text</str>
  </lst>
</initParams>

这意味着我的整个 JSON 将针对密钥src存储。

4

1 回答 1

0

即使您使用的是自己的 schema.xml 文件,您也可能使用默认配置提供的 params.json文件。查看核心的 conf 文件夹并查找 params.json 文件。如果你在那里找到它,把它全部注释掉。

于 2021-09-23T20:40:28.807 回答