4.4 검색 API - _search API
이 문서의 허가되지 않은 무단 복제나 배포 및 출판을 금지합니다. 본 문서의 내용 및 도표 등을 인용하고자 하는 경우 출처를 명시하고 김종민([email protected])에게 사용 내용을 알려주시기 바랍니다.
URI 검색
GET test/_search?q=value{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 0.105360515,
"hits" : [
{
"_index" : "test",
"_type" : "_doc",
"_id" : "3",
"_score" : 0.105360515,
"_source" : {
"field" : "value three"
}
},
{
"_index" : "test",
"_type" : "_doc",
"_id" : "1",
"_score" : 0.105360515,
"_source" : {
"field" : "value two"
}
}
]
}
}GET test/_search?q=value AND three{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 0.87546873,
"hits" : [
{
"_index" : "test",
"_type" : "_doc",
"_id" : "3",
"_score" : 0.87546873,
"_source" : {
"field" : "value three"
}
}
]
}
}GET test/_search?q=field:value{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 0.18232156,
"hits" : [
{
"_index" : "test",
"_type" : "_doc",
"_id" : "3",
"_score" : 0.18232156,
"_source" : {
"field" : "value three"
}
},
{
"_index" : "test",
"_type" : "_doc",
"_id" : "1",
"_score" : 0.18232156,
"_source" : {
"field" : "value two"
}
}
]
}
}데이터 본문 (Data Body) 검색
GET test/_search
{
"query": {
"match": {
"field": "value"
}
}
}{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 0.105360515,
"hits" : [
{
"_index" : "test",
"_type" : "_doc",
"_id" : "3",
"_score" : 0.105360515,
"_source" : {
"field" : "value three"
}
},
{
"_index" : "test",
"_type" : "_doc",
"_id" : "1",
"_score" : 0.105360515,
"_source" : {
"field" : "value two"
}
}
]
}
}멀티테넌시 (Multitenancy)
Last updated