Already have your documents in a .json file, from an export or a script? Upload the file as payload_file instead of writing the request body. It is the same request in another envelope: the same checks, the same job, the same answer.
The whole request in the file
The file holds everything: your email, API key, index name and documents.
{
"email": "you@example.com",
"api_key": "YOUR_API_KEY",
"core_name": "YOUR_INDEX_NAME",
"documents": [
{"uri": "https://example.com/page-1", "title": "Page one", "description": "First page", "text": "Full text of page one."},
{"uri": "https://example.com/page-2", "title": "Page two", "description": "Second page", "text": "Full text of page two."}
]
}
curl -X POST "https://api.opensolr.com/solr_manager/api/ingest" \
-F "payload_file=@my_documents.json"
Only the documents in the file
The file holds just the list of documents ([ {...}, {...} ]); your email, API key and index name go as form fields.
curl -X POST "https://api.opensolr.com/solr_manager/api/ingest" \
-F "email=you@example.com" \
-F "api_key=YOUR_API_KEY" \
-F "core_name=YOUR_INDEX_NAME" \
-F "payload_file=@my_documents.json"
Good to know
- A file holds at most 50 documents, like any request. Split a larger export into several files.
- When the file names an index, that index is used, and an API key limited to some indexes is checked against it.
- A file that cannot be read answers
ERROR_; a file that is not valid JSON answersREADING_ UPLOADED_ FILE ERROR_. Every other answer: Limits and refusals.INVALID_ JSON_ IN_ UPLOADED_ FILE