Retrieving information about the index structure

Until Solr 4.2, we had to look at the schema.xml file to see the full structure of the document. With the release of Solr 4.2, we got the ability to use the so-called Schema API to read the schema of collections that are running inside the cluster or on a node. In this recipe, we will take a look at the possibilities of reading the Solr schema.

How to do it...

The actual schema.xml file that we will use for reading doesn't really matter, as we will not focus on the actual index structure, but the API and how to get the particular information from Solr.

Note

We assume that we are using a collection named cookbook.

  1. We will start with retrieving all the fields defined in our schema.xml file. To do this, ...

Get Solr Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.