[ https://issues.apache.org/jira/browse/SOLR-15064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17260833#comment-17260833 ]
David Smiley commented on SOLR-15064: ------------------------------------- bq. but the documentation does not show how to update a child document using the root document Golly you are right! It _looks_ like any other though... except it doesn't need a {{\_root_}} since this *is* a root doc. bq. which child operation should be used to update an existing child, but not adding it a second time? In your scenario, you describe an _existing_ child document changing (vs adding a new one), so just supply this existing child doc as an update by itself with {{\_root_}} set. Since it's a partial update, it needs to look like one, and thus use the "set" operation for each (or at least one?) field on this partial document. If you forget this, it will not *look* like a partial update, and Solr will try to add it as a normal (root) doc leading to problems (ouch). We should do something about that. In retrospect... it'd be better if merely having a difference between {{\_root_}} and {{id}} fields could make it a partial update and even auto-add it to the root if it doesn't exist (basically add-distinct). This works. At least I tried a variation of this on one of the tests and it did as I expected, though I could possibly have screwed up typing the equivalent JSON here based on the ref guide example. {noformat} { "id": "P11!S21", "_root_":"P11!prod", "color_s": {"set":"ROSE"} } {noformat} bq. I have not tested add-distinct yet Judging from the code (and lack of a test for this case -- I looked); I strongly doubt it works. I'm looking at org.apache.solr.update.processor.AtomicUpdateDocumentMerger#findObjectWithTypeFuzziness It'd be a nice improvement -- PR welcome! > Atomic/partial updates to nested docs should not assume _route_ param is the > root ID > ------------------------------------------------------------------------------------ > > Key: SOLR-15064 > URL: https://issues.apache.org/jira/browse/SOLR-15064 > Project: Solr > Issue Type: Improvement > Security Level: Public(Default Security Level. Issues are Public) > Reporter: David Smiley > Assignee: David Smiley > Priority: Minor > Labels: NestedDocuments > > In SOLR-14923, doing an atomic/partial update to a child doc requires > indicating what the root doc ID is. Formerly Solr tried to figure this out > automatically, but that had costly implications. SOLR-14923 adds a > temporary hack that assumes that the \_route_ paramter *is* the root ID, if > the \_root_ field is not on the doc. But that's not necessarily accurate, so > it should be removed. > -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org