This is a small bit of information on how to query Solr.
This can be used to find information in Solr.
For example, we want to find duplicates.

Two ways to query Solr:

1) Solr dashboard
Use the Solr dashboard and enter the query parameters.

2) URL string query
Paste the query URL in a browser.

The following is an example of a Solr query:


Let’s break it up:

  1. http://localhost:8983/solr/current/select?
  2. fl=uuid_s,metadata_machine_s,keepalive_timestamp_dt
  3. &rows=1000000
  4. &indent=on
  5. &sort=metadata_machine_s+desc
  6. &q=protector_status_s:UNKNOWN
  7. &wt=csv

Each part of the string represents a query filter or output configuration.

  1. Solr server hostname and query URL.
  2. fl = Field list – What columns to show in the result list.
  3. Rows – Number of rows to show. If left empty, 10 rows will be shown.
  4. Indent – Will there be indents in the output (relevant for xml output).
  5. Sort – according to which column do we want to sort + ascending or descending order.
  6. q = Query – Main query string. This is mandatory.
  7. wt = Wright type – How we want the results to output. In the above example we output to CSV.
  8. fq = Filter query – (not found in the above query string) This filters the results that came back from the main query string. Not mandatory.
  9. & = Used to connect between the different fields.
  10. AND / OR = Used in queries as regular and/or operators.

The above information is relevant for the dashboard and string queries.


Note: Browsers translate the space character to HTML format, it will be shown as %20.

Column Alias

It’s possible to give an alias to a column like so:


You can see that the column names uuid_s, metadata_machine_s, and keepalive_timestamp_dt are presented as Morphisec_UUID, Machine_Name, Last_Keepalive.

Not mandatory but looks nice.