Alessandro, I just got this to work myself:
public static final String DEFINED_FIELDS_API = "/schema/fields"; public static final String DYNAMIC_FIELDS_API = "/schema/dynamicfields"; ... // just get a connection to Solr as usual (the factory is mine - it will use CloudSolrServer or HttpSolrServer depending on if we're using SolrCloud or not) SolrClient client = SolrClientFactory.getSolrClientInstance(CLOUD_ENABLED); SolrServer solrConn = client.getConnection(SOLR_URL, collection); SolrQuery query = new SolrQuery(); if (dynamicFields) query.setRequestHandler(DYNAMIC_FIELDS_API); else query.setRequestHandler(DEFINED_FIELDS_API); query.setParam("showDefaults", true); QueryResponse response = solrConn.query(query) Then you've got to parse the response using NamedList etc.etc. -----Original Message----- From: Alessandro Benedetti [mailto:benedetti.ale...@gmail.com] Sent: Tuesday, July 08, 2014 5:54 AM To: solr-user@lucene.apache.org Subject: [Solr Schema API] SolrJ Access Hi guys, wondering if there is any proper way to access Schema API via Solrj. Of course is possible to reach them in Java with a specific Http Request, but in this way, using SolrCloud for example we become coupled to one specific instance ( and we don't want) . Code Example : HttpResponse httpResponse; > String url=this.solrBase+"/"+core+ > SCHEMA_SOLR_FIELDS_ENDPOINT > +fieldName; > HttpPut httpPut = new HttpPut(url); > StringEntity entity = new StringEntity( > "{\"type\":\"text_general\",\"stored\":\"true\"}" , > ContentType.APPLICATION_JSON); > httpPut.setEntity( entity ); > HttpClient client=new DefaultHttpClient(); > response = client.execute(httpPut); Any suggestion ? In my opinion should be interesting to have some auxiliary method in SolrServer if it's not there yet. Cheers -- -------------------------- Benedetti Alessandro Visiting card : http://about.me/alessandro_benedetti "Tyger, tyger burning bright In the forests of the night, What immortal hand or eye Could frame thy fearful symmetry?" William Blake - Songs of Experience -1794 England