# Bulk Partial update of a Nested object List by condition

**URL:** https://discuss.elastic.co/t/bulk-partial-update-of-a-nested-object-list-by-condition/308948
**Category:** Elasticsearch
**Created:** [July 5, 2022, 5:33pm UTC](https://discuss.elastic.co/t/bulk-partial-update-of-a-nested-object-list-by-condition/308948 "2022-07-05T17:33:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![krishnapss](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@krishnapss](https://discuss.elastic.co/u/krishnapss)
#### Post date: [July 5, 2022, 5:33pm UTC](https://discuss.elastic.co/t/bulk-partial-update-of-a-nested-object-list-by-condition/308948/1 "2022-07-05T17:33:40Z")

</div>

Hi,  
I have an index which has nested list object. I need to only update certain values based on a condition. List of history with dates and values I need to update only certain dates values. In the below example **I only want to update historydate 2020-02-01 value not other historydates values in history.**  
Could someone please help me.  
**quick data example (Further below I have added index definition and example data )**

```auto
"history": [
        {
          "historydate": "2020-01-01",
          "quantity": 10
        },
        {
          "historydate": "2020-02-01",
          "quantity": 20
        },
       {
          "historydate": "2020-03-01",
          "quantity": 30
        }
      ]

```

**Index Definition**

```auto
{
    "mappings": {
        "properties": {
            "description": {
                "type": "text",
                "fields": {
                    "keyword": {
                        "type": "keyword",
                        "ignore_above": 256
                    },
                    "normalize": {
                        "type": "keyword",
                        "normalizer": "testnormalizer"
                    }
                }
            },
            "id": {
                "type": "long"
            },
            "market": {
                "type": "nested",
                "properties": {
                    "cost": {
                        "type": "float"
                    },
                    "description": {
                        "type": "text",
                        "fields": {
                            "keyword": {
                                "type": "keyword",
                                "ignore_above": 256
                            },
                            "normalize": {
                                "type": "keyword",
                                "normalizer": "testnormalizer"
                            }
                        }
                    },
                    "history": {
                        "type": "nested",
                        "properties": {
                            "historydate": {
                                "type": "date"
                            },
                            "quantity": {
                                "type": "float"
                            }
                        }
                    },
                    "id": {
                        "type": "long"
                    },
                    "marketid": {
                        "type": "text",
                        "fields": {
                            "keyword": {
                                "type": "keyword",
                                "ignore_above": 256
                            },
                            "normalize": {
                                "type": "keyword",
                                "normalizer": "testnormalizer"
                            }
                        }
                    },
                    "salesprice": {
                        "type": "float"
                    }
                }
            },
            "productid": {
                "type": "text",
                "fields": {
                    "keyword": {
                        "type": "keyword",
                        "ignore_above": 256
                    },
                    "normalize": {
                        "type": "keyword",
                        "normalizer": "testnormalizer"
                    }
                }
            }
        }
    },
    "settings": {
        "index": {
            "number_of_shards": "1",
            "analysis": {
                "normalizer": {
                    "testnormalizer": {
                        "filter": [
                            "lowercase"
                        ],
                        "type": "custom"
                    }
                }
            },
            "number_of_replicas": "1"
        }
    }
}

```

**Data**

```auto
{
  "id": 1,
  "productid": "1",
  "description": "product 1",
  "market": [
    {
      "id": 1,
      "marketid": "1",
      "description": "market 1",
      "salesprice": 10.9,
      "cost": 7.95957,
      "history": [
        {
          "historydate": "2020-01-01",
          "quantity": 1
        },
        {
          "historydate": "2020-02-01",
          "quantity": 2
        }
      ]
    },
     {
      "id": 2,
      "marketid": "2",
      "description": "market 2",
      "salesprice": 12,
      "cost": 12,
      "history": [
        {
          "historydate": "2020-01-01",
          "quantity": 1
        },
        {
          "historydate": "2020-02-01",
          "quantity": 2
        }
      ]
    },
     {
      "id": 3,
      "marketid": "3",
      "description": "market3",
      "salesprice": 15,
      "cost": 15,
      "history": [
        {
          "historydate": "2020-01-01",
          "quantity": 10
        },
        {
          "historydate": "2020-02-01",
          "quantity": 20
        },
       {
          "historydate": "2020-03-01",
          "quantity": 30
        }
      ]
    }    
  ]
}

```

Thank you

---

<div class="post-metadata">

### Author: ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)
#### Post date: [July 6, 2022, 7:06am UTC](https://discuss.elastic.co/t/bulk-partial-update-of-a-nested-object-list-by-condition/308948/2 "2022-07-06T07:06:07Z")

</div>

I'm not sure it still works in the current version, I found a related topic in Stack Overflow.

> <https://stackoverflow.com/questions/53046939/updating-a-nested-object-in-elasticsearch>

---

<div class="post-metadata">

### Author: ![krishnapss](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@krishnapss](https://discuss.elastic.co/u/krishnapss)
#### Post date: [July 8, 2022, 7:28am UTC](https://discuss.elastic.co/t/bulk-partial-update-of-a-nested-object-list-by-condition/308948/3 "2022-07-08T07:28:08Z")

</div>

Hi,  
Thank you very much for replying with some helpful links.  
Is there any Documentation for partially updating Nested Object?  
Could someone please help me to find any examples for NEST Client c# ?

Thank you

---

<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: [August 5, 2022, 7:28am UTC](https://discuss.elastic.co/t/bulk-partial-update-of-a-nested-object-list-by-condition/308948/4 "2022-08-05T07:28:41Z")

</div>

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