* 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.pinyougou.solrutil.SolrUtil.importItemData(SolrUtil.java:33)
at com.pinyougou.solrutil.SolrUtil.main(SolrUtil.java:45)
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
Process finished with exit code 1
原因是方法调用错误 用了 saveBean solrTemplate.saveBean(tbItems);
应该使用 solrTemplate.saveBeans(tbItems);
Caused by: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Document is missing
最新推荐文章于 2021-08-24 13:03:17 发布