ELASTICSEARCH Update
ELASTICSEARCH에 Document(Row)를 수정
curl -XPOST localhost:9200/classes/class/1/ -d '{"title":"Algorithm", "professor":"John"}'
classes
: Index ( RDB's Database )class
: Type ( RDB's Table )1
: Document ( RDB's Row )
Add Field
RDB's Column
Way 1. Basic
curl -XPOST localhost:9200/classes/class/1/_update -d '{"doc":{"unit":1}}'
curl -XGET localhost:9200/classes/class/1?pretty
Before | After |
---|---|
{"title":"Algorithm", "professor":"John"} | {"title":"Algorithm", "professor":"John", "unit": 1} |
Way 2. Script
curl -XPOST localhost:9200/classes/class/1/_update -d '{"script":"ctx._source.unit +=5"}'