-
- elasticsearch, kibana 실행
-
- kibana의 Dev Tools
- http:// 호스트 : 포트 / (인덱스) / _doc / ( doc id ) 로 호출한다.
create, update
- put method로 생성과 수정을 할 수 있다.
request
PUT /index/_doc/1
{
"name":"hwi chan",
"message":"hello world"
}
response
{
"_index" : "index",
"_type" : "_doc",
"_id" : "1",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 6,
"_primary_term" : 1
}
- 최초 생성시 result fied에 created 가 출력된다.
- 수정시 updated 가 출력된다.
get
request
GET /index/_doc/1
response
{
"_index" : "index",
"_type" : "_doc",
"_id" : "1",
"_version" : 6,
"_seq_no" : 5,
"_primary_term" : 1,
"found" : true,
"_source" : {
"name" : "hwi chan",
"message" : "hello world"
}
}
- 요청 성공시 문서의 내용 결과는 _source fied에 표시된다.
{
"error" : {
"root_cause" : [
{
"type" : "index_not_found_exception",
"reason" : "no such index [index]",
"resource.type" : "index_expression",
"resource.id" : "index",
"index_uuid" : "_na_",
"index" : "index"
}
],
"type" : "index_not_found_exception",
"reason" : "no such index [index]",
"resource.type" : "index_expression",
"resource.id" : "index",
"index_uuid" : "_na_",
"index" : "index"
},
"status" : 404
}
- 생성되지 않은 인덱스 요청시 위와 같은 결과가 나타나게 된다.
delete
request
DELETE /index/_doc/1
response
{
"_index" : "index",
"_type" : "_doc",
"_id" : "1",
"_version" : 7,
"result" : "deleted",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 7,
"_primary_term" : 1
}
- result fied에 삭제 여부를 알 수 있다.
- index 삭제
request
DELETE /index
response
{
"acknowledged" : true
}
- 인덱스 삭제 성공시 acknowledged fied에 true가 들어있다.