Update documents using various data types
This example shows how to update values for different datatype fields. Some fields can accept value as Raw JSON (e.g. nested, object, geo_point, geo_shape). Object field type can also accept value by nested field (e.g. [object_field.field1] )
UPDATE my_index
SET
binary_field='SGVsbG8gd29ybGQ=', --base64 value of "Hello world"
boolean_field=false,
byte_field=117,
date_field='2012-12-31T23:59:59.123',
double_field=1.123456789,
float_field=1.123456789,
--raw JSON must be in one line
geo_point_field='{ "lat": 40.7128, "lon": -74.0060 }',
--OR--
--"geo_point_field.lat"=40.7128,
--"geo_point_field.lon"=-74.0060,
--raw JSON must be in one line
geo_shape_field='{ "type": "polygon", "coordinates": [[[-74.0060, 40.7128], [-73.9960, 40.7128], [-73.9960, 40.7028], [-74.0060, 40.7028], [-74.0060, 40.7128]]] }',
integer_field=123,
ip_field='127.0.0.1',
keyword_field='thhi is text',
long_field=1234567890,
--raw JSON must be in one line
nested_field='[{"nested_property_1":"nested text 1", "nested_property_2":100}, {"nested_property_1":"nested text 2", "nested_property_2":101}]',
--raw JSON must be in one line
object_field='{"field1":"A","field2":"B"}',
--OR--
--[object_field.field1]='object field keyword 1',
--[object_field.field1]=123,
short_field=1,
text_field='text field '
WHERE _id=2 --user defined key
--OR-- use auto-generated key
--WHERE _id='MtsicZQBuOa42vmvEtWJ'