当前位置: 首页> 游戏> 评测 > Solr7.4.0报错org.apache.solr.common.SolrException

Solr7.4.0报错org.apache.solr.common.SolrException

时间:2025/7/11 2:49:12来源:https://blog.csdn.net/weixin_45652150/article/details/139658505 浏览次数:0次

文章目录

  • org.apache.solr.common.SolrException: Exception writing document id MATERIAL-99598435990497269125316 to the index; possible analysis error: cannot change DocValues type from NUMERIC to SORTED_NUMERIC for field "opt_time"
  • Exception writing document id MATERIAL-43619171460367415133741 to the index; possible analysis error: cannot change DocValues type from NUMERIC to SORTED_NUMERIC for field "opt_time"

org.apache.solr.common.SolrException: Exception writing document id MATERIAL-99598435990497269125316 to the index; possible analysis error: cannot change DocValues type from NUMERIC to SORTED_NUMERIC for field “opt_time”

查看当前字段定义:

curl http://localhost:8983/solr/your_core/schema/fields/opt_time

请将 your_core 替换为你的Solr核心名称

删除旧字段定义:

curl -X DELETE http://localhost:8983/solr/your_core/schema/fields/opt_time

可以使用 web 页面删除
在这里插入图片描述

重新定义字段:

curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field": {"name": "opt_time","type": "pdate","indexed": true,"stored": true,"docValues": true,"multiValued": false}
}' http://localhost:8983/solr/your_core/schema

Exception writing document id MATERIAL-43619171460367415133741 to the index; possible analysis error: cannot change DocValues type from NUMERIC to SORTED_NUMERIC for field “opt_time”

这个错误信息表明在使用 SolrJ 客户端向 Solr 服务器发送文档时遇到了问题。具体错误是尝试将字段 “opt_time” 的 DocValues 类型从 NUMERIC 更改为 SORTED_NUMERIC,这在 Solr 中是不允许的。

首先,你需要检查 Solr 的 managed-schema 或 schema.xml 文件中字段 “opt_time” 的定义。如果你使用的是 managed-schema,你可以通过 Solr 的管理界面或使用 Schema API 来查看字段定义。

更新字段定义

如果 “opt_time” 字段的 DocValues 类型确实需要是 SORTED_NUMERIC,而当前设置为 NUMERIC,你需要更新字段定义。这可以通过 Schema API 来完成。例如,你可以发送一个 POST 请求来更新字段定义:

curl -X POST -H 'Content-type:application/json' --data-binary '{"update-field": {"name": "opt_time","type": "pdate","indexed": true,"stored": true,"docValues": "SORTED_NUMERIC","multiValued": false}
}' http://localhost:8983/solr/your_core/schema

这里使用的是 update-field如果不行,可以删除掉out_time,使用 add-field来添加

curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field": {"name": "opt_time","type": "pdate","indexed": true,"stored": true,"docValues": "SORTED_NUMERIC","multiValued": false}
}' http://admin:Oi2a@172.111.111.182:8983/solr/2-testcore/schema
关键字:Solr7.4.0报错org.apache.solr.common.SolrException

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: