Enable or Disable Query Elevation
Switches Query Elevation on or off for an index. Enabling patches the Solr configuration for you (component, request handler, elevate.xml) and reloads the index; disabling turns the feature off in your Opensolr account without touching the config files.
Endpoint
GET or POST https://opensolr.com/solr_manager/api/elevation_toggle
Parameters
| Parameter | Status | Description |
|---|---|---|
email | Required | Your Opensolr registration email address |
api_key | Required | Your Opensolr API key (master key, or a scoped key that allows this endpoint) |
core_name | Required | The index to configure |
enable | Required | yes to enable, no to disable — any other value is rejected |
How It Works
enable=yes reads your solrconfig.xml and search.xml on the Solr server. If the QueryElevationComponent is missing it is added; if the /select handler has no elevator last-component it is added; an empty elevate.xml is created when absent. Existing configs are patched in place, never replaced, and the index is reloaded at the end. Running it twice is safe — the second call reports nothing to change.
enable=no only flips the elevation_enabled flag for the index; the Solr config keeps the component so re-enabling is instant.
Once enabled, pin and exclude documents per query from the index Tools page or directly on the hosted search page (how it works).
Response
| Key | Type | Description |
|---|---|---|
status | bool | true on success |
msg | array | One entry per change applied, e.g. Added QueryElevationComponent to solrconfig.xml, Added elevator to search.xml, Core reloaded — or Elevation disabled |
| on error | {"status":false,"msg":"Invalid enable value — must be yes or no"} or Could not read solrconfig.xml |
Code Examples
cURL
curl -s "https://opensolr.com/solr_manager/api/elevation_toggle?email=YOUR_EMAIL&api_key=YOUR_API_KEY&core_name=my_index&enable=yes"
PHP
$q = http_build_query(['email' => 'YOUR_EMAIL', 'api_key' => 'YOUR_API_KEY', 'core_name' => 'my_index', 'enable' => 'yes']); $r = json_decode(file_get_contents("https://opensolr.com/solr_manager/api/elevation_toggle?{$q}"), true); foreach ($r['msg'] as $change) { echo $change, "\n"; }
Python
import requests r = requests.post("https://opensolr.com/solr_manager/api/elevation_toggle", data={ "email": "YOUR_EMAIL", "api_key": "YOUR_API_KEY", "core_name": "my_index", "enable": "yes"}, timeout=60) print(r.json())
Example Response
{ "status": true, "msg": [ "Added QueryElevationComponent to solrconfig.xml", "Added elevator to search.xml", "Core reloaded" ] }
Use Cases
- Enable elevation from a deployment script right after creating an index
- Expose an “Enable Query Elevation” switch in your own CMS admin (the Drupal module and WordPress plugin call this endpoint)
- Temporarily disable curated results during a content migration
Related Documentation
Need help with the Opensolr API? We are here to help.
Contact Support