공부방/Elasticsearch

elasticsearch - bulk

daram 2022. 7. 6. 15:39

classes.json
0.01MB

위 데이터는 아래에서 받을 수 있습니다.

https://github.com/minsuk-heo/BigData/blob/master/ch02/classes.json

 

bulk 파일은 아래와 같은 정보를 가지고 있다.

index와 id에 대한 정보와

본문에 대한 정보를 2줄에 걸쳐 가지고 있다.

 

 

이를 이용하여 elasticsearch에 내용을 저장해보자.

curl -XPOST http://localhost:9200/_bulk 
--header 'content-type: application/json' 
--data-binary @classes.json

 

아래의 명령어로 본문 내용이 잘 들어갔는지 확인해보자.

 

curl -XGET http://localhost:9200/classes/class/1/?pretty
curl -XGET http://localhost:9200/classes/class/2/?pretty
curl -XGET http://localhost:9200/classes/class/3/?pretty
.
.
.