How can I get a list of all the cores in a solr server using SolrJ

benhsu picture benhsu · Jul 12, 2011 · Viewed 17.3k times · Source

We are using Solr for our searches, and sharding the data across several cores. We have one core per week of data, so we are dynamically creating and deleting cores each week.

How can I query a solr server for a list of all its cores? The JavaDoc says I can use coreAdminHandler.getCoreContainer().getCoreNames(), but I'm not sure how to build a coreAdminHandler object.

Answer

Mauricio Scheffer picture Mauricio Scheffer · Jul 12, 2011

A request to http://localhost:8983/solr/admin/cores?action=STATUS (replace your own host/port of course) will return all cores.