Querying WSO2 API-M Indexed Data Using an External Solr Server

Avishka Shamendra
2 min readJul 5, 2024

--

WSO2 API Manager utilizes Solr indexing to facilitate efficient searches through its publisher and developer portals. This process indexes API metadata and other content, which allows searches to be performed based on Solr queries without needing to access the database.

However, indexing can lead to different issues such as APIs not being visible on the devportal. In such instances, you can point a separate Solr server to the Solr data directory residing in the APIM server distribution (<APIM_Server_Home>/solr/data) to analyze the indexed data to see whether there are any issues.

This doc provides the steps to set up the external Solr server and how to use the Solr admin to query the Solr data.

  1. Download the Solr Server version corresponding to the API-M version from https://solr.apache.org/downloads.html. One can find the corresponding Solr version of the API-M from ./repository/components/plugins/solr_x.x.x.jar
  2. Extract the downloaded Solr Server. We will refer to the as <Solr_Server_Home>
  3. Copy <APIM_Server_Home>/repository/conf/solr/registry-indexing folder to <Solr_Server_Home>/server/solr folder.
  4. Open core.properties file inside the registry-indexing folder and update the ‘dataDir’ as ‘dataDir=data’
  5. Copy the data folder inside the <APIM_Server_Home>/solr folder to <Solr_Server_Home>/server/solr/registry-indexing folder.
  6. Navigate to <Solr_Server_Home>/bin folder and start the server
$ ./solr start

for Solr versions 9.x and latter use,

$ ./solr start -Dsolr.modules=scripting

7. Access Solr admin console using the url http://localhost:8983/solr/.

8. Select registry-indexing from the drop down and click on query tab.

9 . Then you can query the indexed data using the Solr admin

For an example, to retrieve all the APIs, you can use API media type as mediaType_s: application/vnd.wso2-api+xml

9. You can stop the server using

$ ./solr stop

Have a nice time querying!

References

[1] — https://medium.com/@sewmijayaweera/how-to-query-solar-data-16a7e051d5cf

[2] — https://medium.com/api-integration-essentials/how-to-query-data-in-a-solr-directory-19473dd5ef0e

--

--

Avishka Shamendra
Avishka Shamendra

Written by Avishka Shamendra

Computer Science and Engineering Graduate from University of Moratuwa, Sri Lanka

No responses yet