본문 바로가기

공부방/Elasticsearch

elasticsearch - update

 

 

curl -XPOST http://localhost:9200/classes/class/1/ 
-d '{"title" : "Algorith", "professor" : "John"}' 
-H "Content-Type: application/json"

 

내용 추가

 

curl -XPOST http://localhost:9200/classes/class/1/_update
-d '{"doc" : {"unit" : 1}}' 
-H "Content-Type: application/json"

 

 

 

값 변경 방법1

curl -XPOST http://localhost:9200/classes/class/1/_update
-d '{"doc" : {"unit" : 2}}' 
-H "Content-Type: application/json"

 

 

curl -XPOST http://localhost:9200/classes/class/1/_update 
-d '{"script" : "ctx._source.unit += 5"}' 
-H "Content-Type: application/json"

 

 

'공부방 > Elasticsearch' 카테고리의 다른 글

elasticsearch - search  (0) 2022.07.06
elasticsearch - 매핑 (mapping)  (0) 2022.07.06
elasticsearch - bulk  (0) 2022.07.06
elasticsearch - CRUD  (0) 2022.07.06
elastic search  (0) 2022.07.06