Missing 집계
Missing 집계
missing 집계는 지정된 필드에 값이 없는 모든 문서를 담은 단일 버킷을 만들어요. 필드가 완전히 없거나 구성된 NULL 값을 포함하면 문서가 누락된 것으로 간주돼요. 이 집계는 일반적으로 다른 버킷 집계와 함께 사용되어 필요한 필드가 없어 다른 버킷에 배치할 수 없는 문서를 처리해요.
출처: 문서
본문
파라미터 (Parameters)
missing 집계는 다음 파라미터를 받아요.
| 파라미터 | 필수/선택 | 데이터 타입 | 설명 |
|---|---|---|---|
| field | 필수 | String | 누락 값을 확인할 필드. |
예제 (Example)
다음 예제는 rating 필드가 없는 문서를 포함하는 products 인덱스(가중 평균 예제에서 생성됨)를 사용해요. 집계는 rating이 누락된 제품 수를 세고, 이를 식별하는 terms 하위 집계를 포함해요:
GET /products/_search
{
"size": 0,
"aggs": {
"without_rating": {
"missing": {
"field": "rating"
},
"aggs": {
"names": {
"terms": {
"field": "name.keyword"
}
}
}
}
}
}
예제 응답 (Example response)
응답은 한 제품(Product C)이 rating 필드가 누락되었음을 보여줘요:
{
"took": 9,
"timed_out": false,
"terminated_early": true,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 4,
"relation": "eq"
},
"max_score": null,
"hits": []
},
"aggregations": {
"without_rating": {
"doc_count": 1,
"names": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "Product C",
"doc_count": 1
}
]
}
}
}
}
응답 본문 필드 (Response body fields)
| 필드 | 데이터 타입 | 설명 |
|---|---|---|
| doc_count | Integer | 지정된 필드가 누락된 문서 수. |