API Endpoint
Check Optimize Status
Check whether an optimization is still running or has completed. Returns current index statistics including segment count, index size, document count, and deleted documents.
Endpoint
GET https://opensolr.com/solr_manager/api/optimize_status
Parameters
| Parameter | Status | Description |
|---|---|---|
email | required | Your Opensolr registration email address |
api_key | required | Your Opensolr API key |
core_name | required | The name of the index being optimized |
Response Fields
| Field | Type | Description |
|---|---|---|
running | boolean | true if optimization is currently in progress |
finished | boolean | true if optimization completed successfully |
segments | integer | Current number of index segments (1 = fully optimized) |
size_bytes | integer | Current index size in bytes |
num_docs | integer | Number of documents in the index |
deleted_docs | integer | Number of deleted documents not yet reclaimed |
Example Response (running)
{"status":true,"msg":{"running":true,"finished":false,"segments":5,"size_bytes":1073741824,"num_docs":50000,"deleted_docs":1200,"log":""}}
Example Response (complete)
{"status":true,"msg":{"running":false,"finished":true,"segments":1,"size_bytes":890000000,"num_docs":50000,"deleted_docs":0,"log":"{...}"}}
Code Examples
cURL
curl -s "https://opensolr.com/solr_manager/api/optimize_status?email=YOUR_EMAIL&api_key=YOUR_API_KEY&core_name=YOUR_INDEX"
PHP
$params = http_build_query([ 'email' => 'YOUR_EMAIL', 'api_key' => 'YOUR_API_KEY', 'core_name' => 'YOUR_INDEX', ]); $response = json_decode(file_get_contents( 'https://opensolr.com/solr_manager/api/optimize_status?' . $params ), true); $info = $response['msg']; if ($info['running']) { echo "Optimization in progress... segments: {$info['segments']}\n"; } elseif ($info['finished']) { echo "Optimization complete! Segments: {$info['segments']}, Size: {$info['size_bytes']} bytes\n"; }
Python
import requests response = requests.get( "https://opensolr.com/solr_manager/api/optimize_status", params={ "email": "YOUR_EMAIL", "api_key": "YOUR_API_KEY", "core_name": "YOUR_INDEX", } ) data = response.json() info = data["msg"] if info["running"]: print(f"Optimization in progress... segments: {info['segments']}") elif info["finished"]: print(f"Optimization complete! Segments: {info['segments']}, Size: {info['size_bytes']} bytes")
Related Documentation
Optimize Index
Start an optimization to merge segments and reclaim space.
Index Full Status
Get the full status of your Solr index.
Need help managing your Solr indexes? We are here to help.
Contact Support