DataStax Help Center

HOW TO - Setup the Luke request handler in Solr to examine indexes

Summary

In some cases when looking into an issue with DSE solr, it may be useful to setup the "Luke" request handler. This article gives an example of how to achieve this

Setup

1 - Modify the solrconfig.xml to comment in the following line:

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

2 - Reload the core

Example

A useful example is to see what is in the index for a given document. Firstly find the unique key which is shown in your schema.xml file for example:

<uniqueKey>id</uniqueKey>

Then use this field to find a list of the unique keys:

http://192.168.56.21:8983/solr/wiki.solr/select?q=*%3A*&fl=id&wt=json&indent=true

The output will look similar to this

{
  "responseHeader":{
    "status":0,
    "QTime":4,
    "params":{
      "fl":"id",
      "indent":"true",
      "q":"*:*",
      "wt":"json"}},
  "response":{"numFound":681,"start":0,"maxScore":1.0,"docs":[
      {
        "id":"23739980"},
      {
        "id":"23740519"},
      {
        "id":"23740602"},
      {
        "id":"23740652"},
      {
        "id":"23740655"},
      {
        "id":"23740742"},
      {
        "id":"23740755"},
      {
        "id":"23740777"},
      {
        "id":"23740778"},
      {
        "id":"23740964"}]
  }}


These ids can then be used to query the index like so:

http://192.168.56.21:8983/solr/wiki.solr/admin/luke?id=23739980

The output will look similar to this (showing just a small section):

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">2</int>
</lst>
<lst name="index">
<int name="numDocs">257</int>
<int name="maxDoc">257</int>
<int name="deletedDocs">0</int>
<long name="indexHeapUsageBytes">72050</long>
<long name="version">47</long>
<int name="segmentCount">3</int>
<bool name="current">true</bool>
<bool name="hasDeletions">false</bool>
<str name="directory">
org.apache.lucene.store.MMapDirectory:MMapDirectory@/var/lib/cassandra/data/solr.data/wiki.solr/index lockFactory=NativeFSLockFactory@/var/lib/cassandra/data/solr.data/wiki.solr/index
</str>
<lst name="userData"/>
</lst>
<lst name="doc">
<int name="docId">0</int>
<lst name="lucene">
<lst name="id">
<str name="type">string</str>
<str name="schema">I-SD----OF------</str>
<str name="flags">ITS-----OF------</str>
<str name="value">23739980</str>
<str name="internal">23739980</str>
<float name="boost">1.0</float>
<int name="docFreq">1</int>
</lst>

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk