# Error about schema casting when updating documents attributes different than the error ones

**URL:** <https://discuss.elastic.co/t/error-about-schema-casting-when-updating-documents-attributes-different-than-the-error-ones/354142>\
**Category:** Elasticsearch\
**Created:** [February 26, 2024, 5:44pm UTC](https://discuss.elastic.co/t/error-about-schema-casting-when-updating-documents-attributes-different-than-the-error-ones/354142 "2024-02-26T17:44:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexandervcc](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@alexandervcc](https://discuss.elastic.co/u/alexandervcc)\
**Post date:** [February 26, 2024, 5:44pm UTC](https://discuss.elastic.co/t/error-about-schema-casting-when-updating-documents-attributes-different-than-the-error-ones/354142/1 "2024-02-26T17:44:33Z")

</div>

Hello, I got some issue with elastic.  
I have a request which updates docs on elastics. this looks like:

```auto
POST /index/_update_by_query
{
   "query":{
         "match":{
              "load": "sync"
          }
    },
    "script":{
            source: `ctx._source.attributes.amount = params.amount`,
            params: { "amount": 59 },
    }
}

```

Even though the script only updates the amount value inside the attributes object, Im getting the next error:  
"field [client] of type [java.util.HashMap] cannot be cast to [java.lang.String]",

May you have some thoughts in what could cause this?

---

<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:** [March 25, 2024, 5:45pm UTC](https://discuss.elastic.co/t/error-about-schema-casting-when-updating-documents-attributes-different-than-the-error-ones/354142/2 "2024-03-25T17:45:27Z")

</div>

Closed on March 25, 2024, 5:45pm UTC

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