Mapping:
"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
{"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:
data class SutdentParam(
val id: UUID,
val startDate: ZonedDateTime,
)
Also it works, when in my class, have used String instead of ZonedDateTime.
data class SutdentParam(
val id: UUID,
val startDate: String,
)
Could you please help me understand what's happening?