# Update By Query fails with 400 - Bad Request - couldn't debug and no details available

**URL:** <https://discuss.elastic.co/t/update-by-query-fails-with-400-bad-request-couldnt-debug-and-no-details-available/358523>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [April 30, 2024, 10:05pm UTC](https://discuss.elastic.co/t/update-by-query-fails-with-400-bad-request-couldnt-debug-and-no-details-available/358523 "2024-04-30T22:05:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Janani\_Sampath\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/janani_sampath_kumar/32/134016_2.png) [@Janani\_Sampath\_Kumar](https://discuss.elastic.co/u/Janani_Sampath_Kumar)\
**Post date:** [April 30, 2024, 10:05pm UTC](https://discuss.elastic.co/t/update-by-query-fails-with-400-bad-request-couldnt-debug-and-no-details-available/358523/1 "2024-04-30T22:05:46Z")

</div>

Mapping:

```auto
 "students": {
          "properties": {
            "_class": {
              "type": "keyword",
              "index": false,
              "doc_values": false
            },
            "id": {
              "type": "keyword"
            },
            "startDate": {
              "type": "date",
              "format": "date_optional_time||epoch_millis"
            }
          }

```

UpdateByQueryRequest: POST /scene/\_update\_by\_query?slices=auto

```auto
{"conflicts":"proceed","query":{"bool":{"filter":[{"terms":{"id":["3ca44d9e-14be-4187-bf38-0bff08981582"]}}},"script":{"params":{"student":"MyStudent(id=4e10fa49-47c3-4cd4-8001-1213825bec7b, startDate=2024-05-16T15:23:20.789Z)"},"lang":"painless","source":"if(ctx._source.students != null) { ctx._source.students.add(params.student); } else { ctx._source.students = new ArrayList(); ctx._source.students.add(params.student); } "}}

```

Here is my Kotlin class used for the param:

```auto
data class SutdentParam(
    val id: UUID,
    val startDate: ZonedDateTime,
)

```

Also it works, when in my class, have used String instead of ZonedDateTime.

```auto
data class SutdentParam(
    val id: UUID,
    val startDate: String,
)

```

Could you please help me understand what's happening?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [May 1, 2024, 10:01am UTC](https://discuss.elastic.co/t/update-by-query-fails-with-400-bad-request-couldnt-debug-and-no-details-available/358523/2 "2024-05-01T10:01:56Z")

</div>

The body of the HTTP response will contain details of the problem. It's not really possible to help without seeing that.

---

<div class="post-metadata">

**Author:** ![Janani\_Sampath\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/janani_sampath_kumar/32/134016_2.png) [@Janani\_Sampath\_Kumar](https://discuss.elastic.co/u/Janani_Sampath_Kumar)\
**Post date:** [May 1, 2024, 10:23am UTC](https://discuss.elastic.co/t/update-by-query-fails-with-400-bad-request-couldnt-debug-and-no-details-available/358523/3 "2024-05-01T10:23:41Z")

</div>

Thanks for the reply.  
Have tried my best to check the error Response even by debugging.  
I'm not getting many details other than saying 400 - Bad Request.

Please find here the stack trace:

 ![Screenshot 2024-05-01 at 11.21.53](https://us1.discourse-cdn.com/elastic/original/3X/a/b/ab1bb5fc2b99a4abebd714ea0f91d1bddc39bae1.png)

```auto
Caused by: co.elastic.clients.transport.TransportException: [es/update_by_query] Failed to decode error response
	at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:291) ~[elasticsearch-java-8.5.3.jar:na]
	at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:148) ~[elasticsearch-java-8.5.3.jar:na]
	at co.elastic.clients.elasticsearch.ElasticsearchClient.updateByQuery(ElasticsearchClient.java:1788) ~[elasticsearch-java-8.5.3.jar:na]

```

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [May 1, 2024, 11:13am UTC](https://discuss.elastic.co/t/update-by-query-fails-with-400-bad-request-couldnt-debug-and-no-details-available/358523/4 "2024-05-01T11:13:21Z")

</div>

That's not the complete error, and the rest of it contains the details you need to look at.

Also see [these docs](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-usage-logging.html) for information about tracing individual requests.

---

<div class="post-metadata">

**Author:** ![Janani\_Sampath\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/janani_sampath_kumar/32/134016_2.png) [@Janani\_Sampath\_Kumar](https://discuss.elastic.co/u/Janani_Sampath_Kumar)\
**Post date:** [May 3, 2024, 5:25pm UTC](https://discuss.elastic.co/t/update-by-query-fails-with-400-bad-request-couldnt-debug-and-no-details-available/358523/5 "2024-05-03T17:25:51Z")

</div>

Could you please point me to an example spring boot Elasticsearch client app that does this configuration?

Have tried different stuffs but still not succeeded in flushing out the Restclient logs except 400 - Bad request.

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [May 3, 2024, 6:13pm UTC](https://discuss.elastic.co/t/update-by-query-fails-with-400-bad-request-couldnt-debug-and-no-details-available/358523/6 "2024-05-03T18:13:19Z")

</div>

I can't, sorry, you might need to ask the Spring Boot folks for help with that.
