API - Get Facetable Fields

Web Crawler
Web Crawler API

Get Facetable Fields

Retrieve all indexed and stored fields from your Solr schema with automatic type classification (string, numeric, date), document counts, and any saved facet filter configuration.

Endpoint

GET https://opensolr.com/solr_manager/api/get_facetable_fields

Parameters

ParameterStatusDescription
emailRequiredYour Opensolr registration email address
api_keyRequiredYour Opensolr API key
core_nameRequiredThe name of the index to get schema fields for

How It Works

This endpoint queries the Solr Luke handler internally on the server where your index runs (via 127.0.0.1:8080). This means it works regardless of any IP restrictions or firewall rules you have configured on your admin handlers — the query never crosses the network.

For point-based numeric and date fields (where Luke reports docs=0), a follow-up stats query is automatically executed to get accurate document counts.

Response

Each field in the response includes:

KeyTypeDescription
fieldstringThe Solr field name (e.g., breadcrumbs_sm, price_f)
typestringClassified type: string, numeric, or date
solr_typestringRaw Solr type from schema (e.g., string, pfloat, pdate)
multibooleanWhether the field is multi-valued
labelstringHuman-readable label (auto-generated or from saved config)
docsintegerNumber of documents containing this field
enabledbooleanWhether this field is enabled as a facet filter (from saved config)
widgetstringWidget type: list, slider, or date_range (from saved config)
weightintegerDisplay order weight (lower = first, from saved config)

Code Examples

$_ cURL

curl -s "https://opensolr.com/solr_manager/api/get_facetable_fields?email=YOUR_EMAIL&api_key=YOUR_API_KEY&core_name=my_solr_core"

PHP PHP

$params = http_build_query([
    'email'     => 'YOUR_EMAIL',
    'api_key'   => 'YOUR_API_KEY',
    'core_name' => 'my_solr_core',
]);
$response = file_get_contents("https://opensolr.com/solr_manager/api/get_facetable_fields?{$params}");
$data = json_decode($response, true);

// List all fields with docs
foreach ($data['fields'] as $field) {
    if ($field['docs'] > 0) {
        echo $field['field'] . " ({$field['type']}, {$field['docs']} docs)\n";
    }
}

Py Python

import requests

response = requests.get("https://opensolr.com/solr_manager/api/get_facetable_fields", params={
    "email": "YOUR_EMAIL",
    "api_key": "YOUR_API_KEY",
    "core_name": "my_solr_core",
})
data = response.json()

# Print fields with data
for field in data["fields"]:
    if field["docs"] > 0:
        print(f"{field['field']} ({field['type']}, {field['docs']:,} docs)")

Example Response

{
  "status": true,
  "fields": [
    {
      "field": "breadcrumbs_sm",
      "type": "string",
      "solr_type": "string",
      "multi": true,
      "label": "Breadcrumbs",
      "docs": 45200,
      "enabled": true,
      "widget": "list",
      "weight": 0
    },
    {
      "field": "price_f",
      "type": "numeric",
      "solr_type": "pfloat",
      "multi": false,
      "label": "Price",
      "docs": 38100,
      "enabled": true,
      "widget": "slider",
      "weight": 1
    },
    {
      "field": "brand_sm",
      "type": "string",
      "solr_type": "string",
      "multi": true,
      "label": "Brand",
      "docs": 42000,
      "enabled": false,
      "widget": "list",
      "weight": 999
    }
  ]
}
The enabled, widget, label, and weight values reflect any saved facet configuration from the Index Settings panel. Fields that haven't been configured yet show enabled: false and weight: 999. Use the Search Facet Filters section in your Index Settings to configure them visually, or build your own UI using this API.

Use Cases

  • Build a custom facet sidebar — Query this endpoint to discover available fields, then add facet.field or stats.field parameters to your Solr queries
  • Dynamic filter UIs — Auto-generate filter dropdowns, sliders, or date pickers based on the field types returned
  • Schema discovery — Inspect what structured data the crawler extracted from your pages (breadcrumbs, product attributes, ratings, etc.)
  • Monitoring — Track which fields have data and how many documents contain each field

Related Documentation

Need help with the Opensolr Web Crawler? We are here to help.

Contact Support