solrgetjsonsolr-schema

Get Solr Schema in json


I was wondering if it's possible to get the full schema or just the fields the schema defines in json format? Obviously I could scrape the page the schema is on

/solr/#/collection1/schema

Do a transformation and create my own json but if solr has a method built in :)

Thanks in advance


Solution

  • You cannot get the schema.xml directly in JSON format but you can get the raw file from Solr instead of haveing to scrape the solr admin page that shows it. You can use this url, where collection1 is the name of your core:

    http://localhost:8080/solr/collection1/admin/file?file=schema.xml&contentType=text/xml;charset=utf-8