问题
Solr provide feature to update document partially and it allows to update on a field level rather than on a document level.
Does solr internally fetch entire document and full reindex it?
would be great if someone can explain how partial update works internally?
回答1:
Starting from solr 4, Solr allows updating partial documents. You can update the value of a field(s) or add/remove values from a multi valued field.
The best practice while using the partial updates or atomic updates in solr is, you define all the indexing fields in schema as stored=true
. When a partial update happen on a document, Solr internally fetches the values for other fields from the previously stored document for reconstructing the document. Then it marks the previous document as deleted and index the new document with higher version.
The advantage is, you need not to send the large document again, if you want to update a specific small field from the index.
The down side of using partial update feature could be larger size of index. Because previously, you might just want to index certain fields without storing them. That will save the space of storing those fields. Now all the indexing fields should be marked as stored=true
in schema. That will increase the size of the index on solr.
来源:https://stackoverflow.com/questions/34643351/how-atomic-or-partial-update-work