Hi team,
I am trying to update a field in the below data B.B1 but the result data is randomly shuffled when I fetch again.
Original
{
"A": {
"A1": "test"
},
"B": {
"B1": "approved"
},
"C": {
"C1": "5f25648c",
"C2": {
"firstName": "Test",
"lastName": "Me"
}
},
"D": "hello",
"E": {
"E1": "2017"
}
}
query for update
POST /test/_update_by_query
{
"script": {
"source": "ctx._source.B.B1='rejected'"
},
"query": {
"term": {
"C.C1": "5f25648c"
}
}
}
Result data after update
{
"D": "hello",
"E": {
"E1": "2017"
},
"B": {
"B1": "rejected"
},
"C": {
"C1": "5f25648c",
"C2": {
"firstName": "Test",
"lastName": "Me"
}
},
"A": {
"A1": "test"
}
}
How can I get the objects in same order as those were before ?
Also what is the difference between script.inline
and script.source
in the update query both updating the record correctly.