dsmiley commented on a change in pull request #647: SOLR-12638: Added docs in
the ref-guide for nested atomic updates
URL: https://github.com/apache/lucene-solr/pull/647#discussion_r279177809
##########
File path: solr/solr-ref-guide/src/updating-parts-of-documents.adoc
##########
@@ -103,6 +103,108 @@ The resulting document in our collection will be:
}
----
+=== Updating Child Documents
+
+Solr supports modifying, adding and removing child documents as part of atomic
updates. +
+Schema and configuration requirements are detailed in
+<<indexing-nested-documents#schema-configuration, Indexing Nested Documents>>.
+
+Under the hood, Solr retrieves the whole nested structure, deletes the old
documents,
+and re-indexes the structure after applying the atomic update. +
+Syntactically, nested/partial updates are very similar to a regular atomic
update,
+as demonstrated by the examples below.
+
+[NOTE]
+====
+.\_route_ Param
+To ensure each nested update is routed to its respective shard,
+`\_route_` param should be set to the root document's ID.
+====
+
+If the following document exists in our collection:
+
+[source,json]
+----
+{
+ "id":"mydoc",
+ "product":"T-Shirt",
+ "stock": {
+ "id":"mydoc2",
+ "color":"red",
+ "size": ["L"]
+ }
+}
+----
+
+And we apply the following update command, setting `\_route_`=mydoc:
+
+[source,json]
+----
+{
+ "id":"mydoc",
+ "stock": {
+ "add":
+ {
+ "id":"mydoc3",
+ "color":"blue",
+ "size": ["M"]
+ }
+ }
+}
+----
+
+The resulting document in our collection will be:
+
+[source,json]
+----
+{
+ "id":"mydoc",
+ "product":"T-Shirt",
+ "stock": [{
+ "id":"mydoc2",
+ "color":"red",
+ "size": ["L"]
+ },
+ {
+ "id":"mydoc3",
+ "color":"blue",
+ "size": ["M"]
+ }]
+}
+----
+
+Documents inside nested structures can also be updated, provided `\_route_` is
set to the root document's ID
Review comment:
RE "provided"... that wording suggests \_route_ is optional. It's NOT,
right? Then instead say nothing or just remind the user what it should be.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]