Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr: where to find the Luke request handler

Tags:

solr

solr4

I'm trying to get a list of all the fields, both static and dynamic, in my Solr index. Another SO answer suggested using the Luke Request Handler for this.

It suggests finding the handler at this url:

http://solr:8983/solr/admin/luke?numTerms=0

When I try this url on my server, however, I get a 404 error.

The admin page for my core is here http://solr:8983/solr/#/mycore, so I also tried http://solr:8983/solr/#/mycore/admin/luke. This also gave me another 404.

Does anyone know what I'm doing wrong? Which url should I be using?

like image 663
dB' Avatar asked Nov 25 '25 18:11

dB'


2 Answers

First of all you have to enable the Luke Request Handler. Note that if you started from the example solrconfig.xml you probably don't need to enable it explicitly because

<requestHandler name="/admin/" class="solr.admin.AdminHandlers" />

does it for you.

Then if you need to access the data programmatically you have to make an HTTP GET request to http://solr:8983/solr/mycore/admin/luke (no hash mark!). The response is in XML but specifying wt parameter you can obtain different formats (e.g. http://solr:8983/solr/mycore/admin/luke?wt=json)

If you only want to see fields in SOLR web interface select your core from the drop down menu and then click on "Schema Browser"

like image 75
Zac Avatar answered Nov 28 '25 08:11

Zac


In Solr 6, the solr.admin.AdminHandlers has been removed. If your solrconfig.xml has the line <requestHandler name="/admin/" class="solr.admin.AdminHandlers" />, it will fail to load. You will see errors in the log telling you it failed to load the class org.apache.solr.handler.admin.AdminHandlers.

You must include in your solrconfig.xml the line,

<requestHandler name="/admin/luke" class="org.apache.solr.handler.admin.LukeRequestHandler" />

but the URL is core-specific, i.e. http://your_server.com:8983/solr/your_core_name/admin/luke

And you can specify the parameters fl,numTerms,id,docId as follows:

  • /admin/luke
  • /admin/luke?fl=cat
  • /admin/luke?fl=id&numTerms=50
  • /admin/luke?id=SOLR1000
  • /admin/luke?docId=2
like image 35
laloumen Avatar answered Nov 28 '25 08:11

laloumen