embed
The embed
endpoint allows you to generate vector embeddings for any arbitrary text payload (up to 50,000 characters) and store those embeddings in your specified Opensolr index. This is ideal for embedding dynamic or ad-hoc content, without having to pre-index data in Solr first.
https://api.opensolr.com/solr_manager/api/embed
Supports only POST requests.
Parameter | Type | Required | Description |
---|---|---|---|
string | Yes | Your Opensolr registration email address. | |
api_key | string | Yes | Your API key from the Opensolr dashboard. |
index_name | string | Yes | Name of your Opensolr index/core to use. |
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
payload | string | Yes | – | The raw text string to embed. Maximum: 50,000 characters. |
payload
can be any UTF-8 text (e.g., a document, user input, generated content, etc).payload
is missing or less than 2 characters, the API returns a 404 error with a JSON error response.index_name
to indicate where the embedding should be stored (requires the appropriate field in your Solr schema).To store embeddings, your Solr schema must define an appropriate vector field, for example:
<field name="embeddings" type="vector" indexed="true" stored="false" multiValued="false"/>
<fieldType name="vector" class="solr.DenseVectorField" vectorDimension="384" required="false" similarityFunction="cosine"/>
Adjust the name
, type
, and vectorDimension
as needed to fit your use-case and model.
POST https://api.opensolr.com/solr_manager/api/embed
Content-Type: application/x-www-form-urlencoded
[email protected]&api_key=YOUR_API_KEY&index_name=your_index&payload=Your text to embed here.
email
and api_key
.payload
parameter (must be 2-50,000 characters).{
"status": "success",
"embedding": [/* vector values */],
"length": 4381
}
Or, for invalid input:
{
"ERROR": "Invalid payload"
}
For more information or help, visit Opensolr Support or use your Opensolr dashboard.