Hi

I used 'type" instead of Field Type, seems to be working...


Thx for the Help

Closing this Thread.

On 2021/10/11 17:44:38, Erik Hatcher <erik.hatc...@gmail.com> wrote: 
> It appears you should use "type" instead "field type" in your Java code.  
> (**'type' is a required field** says the error message)
> 
>       Erik
> 
> 
> > On Oct 11, 2021, at 12:14 PM, nskarthik <nskarthi...@gmail.com> wrote:
> > 
> > Hi
> > 
> > Spec : using java 15 with SolrJ 8.10.0 / Solr
> > 
> > Process : I already tryed this peice of code from Solrj Src  on github.
> > 
> > SchemaRequest.AddField addFieldRequest = new 
> > SchemaRequest.AddField(fieldAttributes);
> > SchemaResponse.UpdateResponse addFieldResponse = 
> > addFieldRequest.process(solrClient, collectionName);
> > 
> > Response on executing the code : 
> > 
> > Created a Core : /solr -create -c testingSolarCore
> > 
> > Endpoint : "http://localhost:8081/solr";
> > Collection name : "testingSolarCore"
> > SolrCoreAdminManageFieldTyposBean scrBn  as Bean storing the values as 
> > follows
> > 
> > solrCoreFieldTypeContent = new HashMap<String, Object>();                   
> >         
> > solrCoreFieldTypeContent.put("name",         scrBn.getFieldName());
> > solrCoreFieldTypeContent.put("field type",   scrBn.getFieldType());
> > solrCoreFieldTypeContent.put("stored",       scrBn.isFieldStored());
> > solrCoreFieldTypeContent.put("indexed",      scrBn.isFieldIndexed());
> > solrCoreFieldTypeContent.put("uninvertible", scrBn.isFieldUninvertible());
> > solrCoreFieldTypeContent.put("docValues",    scrBn.isFieldDocValues());
> > solrCoreFieldTypeContent.put("multiValued",  scrBn.isFieldMultiValued());
> > solrCoreFieldTypeContent.put("required",     scrBn.isFieldRequired());
> > 
> > addFieldRequest = new SchemaRequest.AddField(solrCoreFieldTypeContent);
> > addFieldResponse = addFieldRequest.process(SolrClnt_, 
> > solrCoreAdmnBn.getNewCollectname());
> > this.solrCommit();
> > 
> > Output :  
> > 
> > Error from server at http://localhost:8081/solr: error processing commands, 
> > errors: [{add-field={indexed=true, stored=true, name=testNames, 
> > uninvertible=true, field type=String, docValues=false, multiValued=false, 
> > required=false}, errorMessages=['type' is a required field]}], 
> > 
> > 
> > Can u plz share a snippet code for the same...
> > 
> > 
> > 
> > 
> > 
> > On 2021/10/11 09:57:01, Steffen Moldenhauer 
> > <s.moldenha...@intershop.de.INVALID> wrote: 
> >> Hi, 
> >> 
> >> You can use the org.apache.solr.client.solrj.request.schema.SchemaRequest 
> >> from solrj: 
> >> 
> >> SchemaRequest.AddField addFieldRequest = new 
> >> SchemaRequest.AddField(fieldAttributes);
> >> SchemaResponse.UpdateResponse addFieldResponse = 
> >> addFieldRequest.process(solrClient, collectionName);
> >> 
> >> Kind regards
> >> 
> >>> -----Original Message-----
> >>> From: nskarthik <nskarthi...@gmail.com>
> >>> Sent: Sonntag, 10. Oktober 2021 19:02
> >>> To: users@solr.apache.org
> >>> Subject: Re: Solrj for addField for indexing document
> >>> 
> >>> Hi
> >>> 
> >>> I am trying to implement  new Fields as stated in this URL
> >>> https://solr.apache.org/guide/8_1/schema-api.html
> >>> 
> >>> using java code with SolrJ 8.8.1
> >>> 
> >>> Note: I do not want to use Solr web schema API to do this task and preffer
> >>> java code level to do this job,
> >>> 
> >>> Request : Please share a sinppet  of code for the same.
> >>> 
> >>> with regards
> >>> 
> >>> 
> >>> 
> >>> On 2021/10/06 09:56:29, KARTHIK SHIVAKUMAR <nskarthi...@gmail.com>
> >>> wrote:
> >>>> Hi
> >>>> 
> >>>> Spec : Jdk 15, Solr 8.8.1
> >>>> 
> >>>> Question : Can solrj ( client )   be used to add new 'addField' into 
> >>>> schema
> >>> for setup so as to index the documents later  instead of getting missing 
> >>> field
> >>> type exception.
> >>>> 
> >>>> Note: I do not want to use Solr web schema API to do this task and
> >>>> preffer java code level to do this job,
> >>>> 
> >>>> Request : Please share a sinppet  of code for the same.
> >>>> 
> >>>> 
> >>>> Thx for the same.
> >>>> 
> >> 
> 
> 

Reply via email to