API - Optimize a Solr Index

Index Management

Starts an optimize of your Opensolr Index in the background: Solr merges it into one segment and drops the deleted documents for good.

Endpointhttps://opensolr.com/solr_manager/api/optimize
MethodGET
Authemail and api_key of your account, as GET or POST parameters: Authentication.
In the panelOptimize

01 · Parameters

core_nameRequired

The name of your index.

02 · Example

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

03 · Answer

{
    "status": true,
    "working": true,
    "started": true,
    "done_time_ms": null,
    "segments": 14,
    "size_bytes": 734003200,
    "num_docs": 120000,
    "deleted_docs": 8200
}
working

true while an optimize runs.

started

true when this call started it, false when one was already running.

done_time_ms

How long the last finished optimize took, when there was one.

segments, size_bytes, num_docs, deleted_docs

The index as it is now.

An optimize of a large index takes a while and uses the disk and CPU of the server. Run it after big changes, not after every update.

04 · Errors

ERROR_NOT_CORE_OWNERHTTP 200

The index is not yours.

ERROR_AUTHENTICATION_FAILEDHTTP 403

The email and API key do not match.

ERROR_RATE_LIMIT_PER_MINUTEHTTP 429

Too many calls. Wait for the Retry-After seconds: Rate limits.

05 · Related

Follow it: optimize_status. A recurring optimize from the Control Panel: Schedule Optimize.

Every error code and HTTP status of the API: API errors. Calls per minute and per hour: Rate limits.