Solr异常:Caused by: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Document is

Exception in thread "main" org.springframework.data.solr.UncategorizedSolrException: Document is missing mandatory uniqueKey field: id; nested exception is org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Document is missing mandatory uniqueKey field: id
	at org.springframework.data.solr.core.SolrTemplate.execute(SolrTemplate.java:145)
	at org.springframework.data.solr.core.SolrTemplate.saveBean(SolrTemplate.java:184)
	at org.springframework.data.solr.core.SolrTemplate.saveBean(SolrTemplate.java:178)
	at com.offcn.solrutil.SolrUtil.importItemData(SolrUtil.java:36)
	at com.offcn.solrutil.SolrUtil.main(SolrUtil.java:44)
Caused by: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Document is missing mandatory uniqueKey field: id
	at org.apache.solr.client.solrj.impl.HttpSolrServer.executeMethod(HttpSolrServer.java:552)
	at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:210)
	at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:206)
	at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:124)
	at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:116)
	at org.springframework.data.solr.core.SolrTemplate$4.doInSolr(SolrTemplate.java:187)
	at org.springframework.data.solr.core.SolrTemplate$4.doInSolr(SolrTemplate.java:184)
	at org.springframework.data.solr.core.SolrTemplate.execute(SolrTemplate.java:141)
	... 4 more

解决方案一

Solr异常:Caused by: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Document is_第1张图片
在这里插入图片描述

解决方案二、这个问题的可能原因是schema.xml配置文件中存在

Solr异常:Caused by: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Document is_第2张图片
Solr异常:Caused by: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Document is_第3张图片
取消Id的required=true,或上uniqueKey修改为要上传的字段。

你可能感兴趣的:(Solr异常:Caused by: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Document is)