Dear Community,


I am using Solr 7.7 and I am wondering how it is possible to do a partial
update on nested documents / child documents.

Suppose I have committed the following documents to the index:

[

  {

    "id": "1",

    "testString": "1",

    "testInt": "1",

    "_childDocuments_": [

      {

        "id": "1.1",

        "child_type": "child_a",

        "testString": "1.1",

        "testInt": "1"

      },

      {

        "id": "1.2",

        "child_type": "child_a",

        "testString": "1.1",

        "testInt": "1"

      }

    ]

  }

]

<uniqueKey> is id, all fields are indexed.



Now I want to update testInt to 2 on the parent document without losing the
parent child relation (ChildDocTransformerFactory should still produce
correct results).

I tried the following variants, both not successful:



*Variant 1:*

Sending the following update document to the update-Endpoint

[

  {

    "id": "1",

    "testInt": {

      "set": "2"

    }

  }

]

The parent document is updated, but the ChildDocTransformerFactory does not
return any child documents



*Variant 2:*

Sending the following update document to the update-Endpoint

[

  {

    "id": "1",

    "testInt": {

      "set": "2"

    },

    "_childDocuments_": [

      {

        "id": {

          "set": "1.1"

        }

      },

      {

        "id": {

          "set": "1.2"

        }

      }

    ]

  }

]

Same result: Parent is updated, but ChildDocTransformerFactory does not
return any child documents





Is there any other way of doing a partial update without losing the parent
child relation?

Resending the complete document with all attributes and children would work
but is inefficient for us (we had to load all documents from Solr before
resending them).



Thanks in advance for your help



Ludger


------------------------------

*„Beste Arbeitgeber ITK 2020“ - 1. Platz für QAware*
ausgezeichnet von Great Place to Work
<https://www.qaware.de/news/great-place-to-work-deutschlands-beste-arbeitgeber-2020/>
------------------------------

Ludger Steens
Softwarearchitekt

QAware GmbH
Aschauer Straße 32
81549 München, Germany
Mobil +49 175 7973969
ludger.ste...@qaware.de
www.qaware.de
------------------------------

Geschäftsführer: Christian Kamm, Johannes Weigend, Dr. Josef Adersberger
Registergericht: München
Handelsregisternummer: HRB 163761

Reply via email to