Guna Kibana Dev's Tool
1- Create documents dalam elasticsearch
POST /coba-alfa/_doc/
{
"id": 124,
"name": "malware",
"age": 26,
"maklumat": {
"tangan": 2,
"warna": "Coklat",
"tinggi": 170,
"kepantasan": "rendah"
}
}
2- update maklumat.kepantasan menjadi tinggi , hanya utk semua yg ada 2 maklumat.tangan
POST coba-*/_update_by_query
{
"script" : {
"source": "ctx._source.maklumat.kepantasan='tinggi';",
"lang": "painless"
},
"query": {
"term" : {
"maklumat.tangan": 2
}
}
}
ref: https://stackoverflow.com/questions/19563215/update-only-specific-field-value-in-elasticsearch
No comments:
Post a Comment
Terima kasih