问题
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?
回答1:
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"
回答2:
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
回答3:
You can use this Luke tool which allows you to explore Lucene index.
You can also use the solr admin page : http://localhost:8983/solr/#/core/schema-browser
来源:https://stackoverflow.com/questions/28889405/solr-where-to-find-the-luke-request-handler