官方文檔:https://wiki.apache.org/solr/Atomic_Updatesapache
SolrInputDocument solrInputDocument = new SolrInputDocument();
solrInputDocument.addField("id", id);
Map<String, String > operation = new HashMap<>();
operation.put("set", "test1");
solrInputDocument.addField("title", operation);
solrServer.add(solrInputDocument);
solrServer.commit();ui
官方文檔中,要注意:atom
The core functionality of atomically updating a document requires that all fields in your SchemaXml must be configured as stored="true"spa
solr原子更新,支持store=true,若是store爲false,更新後字段會丟失。文檔