Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-6096

Support Update and Delete on nested documents

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 4.7.2
    • 8.0
    • None

    Description

      When using nested or child document. Update and delete operation on the root document should also affect the nested documents, as no child can exist without its parent

      Example

      First Import
      <doc>
        <field name="id">1</field>
        <field name="title">Article with author</field>
        <doc>
          <field name="name">Smith, John</field>
          <field name="role">author</field>
        </doc>
      </doc>
      

      If I change my mind and the author was not named John but Jane:

      Changed name of author of '1'
      <doc>
        <field name="id">1</field>
        <field name="title">Article with author</field>
        <doc>
          <field name="name">Smith, Jane</field>
          <field name="role">author</field>
        </doc>
      </doc>
      

      I would expect that John is not in the index anymore. Currently he is. There might also be the case that any subdocument is removed by an update:

      Remove author
      <doc>
        <field name="id">1</field>
        <field name="title">Article without author</field>
      </doc>
      

      This should affect a delete on all nested documents, too. The same way all nested documents should be deleted if I delete the root document:

      Deletion of '1'
      <delete>
        <id>1</id>
        <!-- implying also
          <query>_root_:1</query>
         -->
      </delete>
      

      This is currently possible to do all this stuff on client side by issuing additional request to delete document before every update. It would be more efficient if this could be handled on SOLR side. One would benefit on atomic update. The biggest plus shows when using "delete-by-query".

      Deletion of '1' by query
      <delete>
        <query>title:*</query>
        <!-- implying also
          <query>_root_:1</query>
         -->
      </delete>
      

      In that case one would not have to first query all documents and issue deletes by those id and every document that are nested.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              thosch Thomas Scheffler
              Votes:
              7 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: