-d 뒤에 자세한 옵션을 적을 수 있다.
(작은 따옴표를 닫기 전에는 엔터를 입력해도 된다.)
아래의 경우 과목명을 알고리즘으로 교수를 존으로 넣겠다는 내용을 json형식(인터넷 요청 양식으로) 입력하는 것
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/classes/class/1/ -d '{"title" : "Algorithm", "professor" : "John"}'
Point: elasticsearch 6.0 버전 부터는 본문이 있는 요청의 경우 헤더를 application/json으로 지원
(관련 옵션: -H "Content-Type: application/json")
아래처럼 successful 뜨면 완료
이제 올린 Index 확인 해보기
curl -XGET http://localhost:9200/classes/class/1
json파일이 있는 경로로 이동.
oneclass.json 파일 내용 확인
less oneclass.json
이 파일로 도큐먼트 만들기
curl -XPOST -H "Content-Type: application/json" http://localhost:9200/classes/class/1/ -d @oneclass.json
이제 생성한 index 확인하기
curl -XGET http://localhost:9200/classes/class/1