# Update nested document java api

**URL:** <https://discuss.elastic.co/t/update-nested-document-java-api/236126>\
**Category:** Elasticsearch\
**Created:** [June 8, 2020, 6:58am UTC](https://discuss.elastic.co/t/update-nested-document-java-api/236126 "2020-06-08T06:58:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohit.singh3](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@rohit.singh3](https://discuss.elastic.co/u/rohit.singh3)\
**Post date:** [June 8, 2020, 6:58am UTC](https://discuss.elastic.co/t/update-nested-document-java-api/236126/1 "2020-06-08T06:58:57Z")

</div>

i have below document structure:

```auto
{
        "_index" : "products",
        "_type" : "_doc",
        "_id" : "1f119af3-3b37-42bf-bd74-14266ad0487b",
        "_score" : 1.0,
        "_source" : {
          "id" : "1f119af3-3b37-42bf-bd74-14266ad0487b",
          "name" : "app1",
          "appVersions" : [
            {
              "versionId" : "94b324f5-b0d1-42f5-857c-05df83c47beb",
              "galleryImages" : [
                {
                  "profileImageName" : "apps/versions/gallery/SMALL_e3df848f-4706-48e7-99dc-0ff8a9eb2fee0",
                  "thumbnailImageName" : "apps/versions/gallery/LARGE_e3df848f-4706-48e7-99dc-0ff8a9eb2fee0"
                },
                {
                  "profileImageName" : "apps/versions/gallery/SMALL_e3df848f-4706-48e7-99dc-0ff8a9eb2fee1",
                  "thumbnailImageName" : "apps/versions/gallery/LARGE_e3df848f-4706-48e7-99dc-0ff8a9eb2fee1"
                }
              ]
            },
            {
              "versionId" : "9749070b-a384-4c67-bb72-9b6a8e008ca9",
              "galleryImages" : [
                {
                  "profileImageName" : "apps/versions/gallery/SMALL_e3df848f-4706-48e7-99dc-0ff8a9eb2fee0",
                  "thumbnailImageName" : "apps/versions/gallery/LARGE_e3df848f-4706-48e7-99dc-0ff8a9eb2fee0"
                },
                {
                  "profileImageName" : "apps/versions/gallery/SMALL_e3df848f-4706-48e7-99dc-0ff8a9eb2fee1",
                  "thumbnailImageName" : "apps/versions/gallery/LARGE_e3df848f-4706-48e7-99dc-0ff8a9eb2fee1"
                }
              ]
            }
          ]
        }
      }

```

here each app has an array of app-versions and each app-version has an array of gallery-images.

i want to update gallery images for matching versionId. can any one suggest how to achieve this using java apis.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2020, 6:58am UTC](https://discuss.elastic.co/t/update-nested-document-java-api/236126/2 "2020-07-06T06:58:57Z")

</div>

Closed on July 6, 2020, 6:58am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
