[ https://issues.apache.org/jira/browse/SOLR-6608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14166883#comment-14166883 ]
Guido commented on SOLR-6608: ----------------------------- Dear Hoss Man, Thank you very much for you response. I will surely open a thread on the mailing list. About this issue, I never modified the schema after that I have started to index my documents and the document on which I am experiencing issues has all the required fields properly filled, considering also the "cityId". Anyway, thank you for your help and support. As said, I will open a thread on the mailing list as specified. Best Regards, Guido > Atomic update with CloudSolrServer gives 'missing required field:' > ------------------------------------------------------------------ > > Key: SOLR-6608 > URL: https://issues.apache.org/jira/browse/SOLR-6608 > Project: Solr > Issue Type: Bug > Components: SolrCloud, update > Reporter: Guido > > Dear support, > My version of Solr is 4.8.0. I am trying to update a single field of a > document which is already present inside my collection. This is the part of > code involved: > _CloudSolrServer server = new CloudSolrServer(args[0]);_ > _server.setDefaultCollection(args[1]);_ > [...] > _SolrInputDocument updateSolrDoc = new SolrInputDocument();_ > _String id = [...]_ > _updateSolrDoc.addField("id", id);_ > _List<String> phoneNumbers = [...]_ > _updateSolrDoc.setField("phoneNumbers", Collections.singletonMap("set", > phoneNumbers));_ > [...] > _buffer.add(updateSolrDoc);_ > [...] > _server.add(buffer);_ > _server.commit();_ > When I try to run it, I receive the following exception: > 2014-10-08 15:57:40.587 - ERROR org.apache.solr.common.SolrException > org.apache.solr.common.SolrException: [doc=1021938980] missing required > field: cityId > at > org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:189) > at > org.apache.solr.update.AddUpdateCommand.getLuceneDocument(AddUpdateCommand.java:77) > at > org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:234) > at > org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:160) > at > org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:69) > at > org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:51) > at > org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:704) > at > org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:858) > at > org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:557) > at > org.apache.solr.handler.loader.JavabinLoader$1.update(JavabinLoader.java:96) > at > org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$1.readOuterMostDocIterator(JavaBinUpdateRequestCodec.java:166) > at > org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$1.readIterator(JavaBinUpdateRequestCodec.java:136) > at > org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:225) > at > org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$1.readNamedList(JavaBinUpdateRequestCodec.java:121) > at > org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:190) > at > org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:116) > at > org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec.unmarshal(JavaBinUpdateRequestCodec.java:173) > at > org.apache.solr.handler.loader.JavabinLoader.parseAndLoadDocs(JavabinLoader.java:106) > at > org.apache.solr.handler.loader.JavabinLoader.load(JavabinLoader.java:58) > at > org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:92) > at > org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74) > at > org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135) > at org.apache.solr.core.SolrCore.execute(SolrCore.java:1952) > at > org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:774) > at > org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:418) > at > org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:207) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) > at > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) > at > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) > at java.lang.Thread.run(Thread.java:744) > This, instead, is the part of the schema.xml involved: > _<field name="id" type="string" indexed="true" stored="true" > required="true" />_ > [...] > _<field name="cityId" type="string" indexed="true" stored="true" > required="true" />_ > [...] > _<field name="phoneNumbers" type="string" indexed="true" stored="true" > required="false" multiValued="true" sortMissingLast="true" />_ > [...] > _<uniqueKey>id</uniqueKey>_ > I have also another collection with a similar schema and I am using a similar > code to perform atomic updates without issues, i.e. I don't need to specify > all the fields marked as 'required' in order to update a single field. > Unfortunately with this second collection I get this weird issue. > How can I successfully update a single field without having to pass all the > fields marked as 'required'? Can you please tell me if there is something > wrong in the code that I am using? > Thank you very much for your support. > Kind Regards -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org