Bulk Partial update of a Nested object List by condition

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 )

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

Index Definition

{
    "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

{
  "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

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

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

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