embed_opensolr_index
Using the embed_opensolr_index
endpoint involves Solr atomic updates, meaning each Solr document is updated individually with the new embeddings. Atomic updates in Solr only update the fields you include in the update payload—all other fields remain unchanged. However, you cannot generate embeddings from fields that are stored=false
, because Solr cannot retrieve their values for you.
You will not lose stored=false
fields just by running an atomic update. Atomic updates do NOT remove or overwrite fields you do not explicitly update. Data loss of non-stored fields only happens if you replace the entire document (full document overwrite), not during field-level atomic updates.
Because of this, it’s highly recommended to understand the implications of Solr atomic updates clearly. For most users, the safer approach is to create embeddings at indexing time (using the /embed
endpoint), especially if you rely on non-stored fields for downstream features.
Please review the official documentation on Solr Atomic Updates to fully understand these implications before using this endpoint.
schema.xml
<!--VECTORS-->
<field name="embeddings" type="vector" indexed="true" stored="true" multiValued="false" required="false" />
<fieldType name="vector" class="solr.DenseVectorField" vectorDimension="384" similarityFunction="cosine"/>
$ curl -u <INDEX_USERNAME>:<INDEX_PASSWORD> https://<OPENSOLR_INDEX_HOST>solr/<OPENSOLR_INDEX_NAME>/schema/fieldtypes -H 'Content-type:application/json' -d '{
"add-field-type": {
"name": "vector",
"class": "solr.DenseVectorField",
"vectorDimension": 384,
"similarityFunction": "cosine"
}
}'
$ curl -u <INDEX_USERNAME>:<INDEX_PASSWORD> https://<OPENSOLR_INDEX_HOST>solr/<OPENSOLR_INDEX_NAME>/schema/fields -H 'Content-type:application/json' -d '{
"add-field": {
"name":"embeddings",
"type":"vector",
"indexed":true,
"stored":false, // true if you want to see the vectors for debugging
"multiValued":false,
"required":false,
"dimension":384, // adjust to your embedder size
"similarityFunction":"cosine"
}
}'
solrconfig.xml
:<!-- The default high-performance update handler -->
<updateHandler class="solr.DirectUpdateHandler2">
<updateLog>
<int name="numVersionBuckets">65536</int>
<int name="maxNumLogsToKeep">10</int>
<int name="numRecordsToKeep">10</int>
</updateLog>
.....
</updateHandler>
The embed_opensolr_index
endpoint allows Opensolr users to generate and store text embeddings for documents in their Opensolr indexes using a Large Language Model (LLM). These embeddings power advanced features such as semantic search, classification, and artificial intelligence capabilities on top of your Solr data.
https://api.opensolr.com/solr_manager/api/embed_opensolr_index
Supports both GET and POST methods.
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 be embedded. |
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
emb_solr_fields | string | No | title,description,text | Comma-separated list of Solr fields to embed (can be any valid fields in your index). |
emb_solr_embeddings_field_name | string | No | embeddings | Name of the Solr field to store generated embeddings. |
emb_full_solr_grab | bool | string | No | false | If “yes”, embed all documents in the index; otherwise use pagination parameters below. |
emb_solr_start | integer | No | 0 | Starting document offset (for pagination). |
emb_solr_rows | integer | No | 10 | Number of documents to process in the current request (page size). |
emb_solr_fields
, which defaults to title,description,text
, but you may specify any fields from your index for embedding.emb_solr_embeddings_field_name
to match the embeddings field in your schema.schema.xml
. Example configuration:<field name="embeddings" type="vector" indexed="true" stored="false" multiValued="false"/>
<fieldType name="vector" class="solr.DenseVectorField" vectorDimension="384" required="false" similarityFunction="cosine"/>
embeddings
and vector
with your custom names if you use different field names.Solr atomic updates update only the fields you specify in the update request. Other fields—including those defined as non-stored (stored=false
)—are not changed or removed by an atomic update. However, since non-stored fields cannot be retrieved from Solr, you cannot use them to generate embeddings after indexing time.
If you ever replace an entire document (full overwrite), non-stored fields will be lost unless you explicitly provide their values again.
yes
to embed all documents in the index; otherwise, the endpoint uses pagination.POST https://api.opensolr.com/solr_manager/api/embed_opensolr_index
Content-Type: application/x-www-form-urlencoded
[email protected]&api_key=YOUR_API_KEY&index_name=your_index
POST https://api.opensolr.com/solr_manager/api/embed_opensolr_index
Content-Type: application/x-www-form-urlencoded
[email protected]&api_key=YOUR_API_KEY&index_name=your_index&emb_solr_fields=title,content&emb_solr_embeddings_field_name=embeddings&emb_full_solr_grab=yes
GET https://api.opensolr.com/solr_manager/api/[email protected]&api_key=YOUR_API_KEY&index_name=your_index
email
and api_key
.index_name
.emb_solr_fields
.emb_solr_embeddings_field_name
.emb_full_solr_grab
is yes
, processes all documents; otherwise uses emb_solr_start
and emb_solr_rows
for batch processing.For more information or help, visit Opensolr Support or use your Opensolr dashboard.