계정 account_id (내 관계형 데이터베이스의 기본 키)와 상태 필드가있는 문서가 있습니다. 계정 상태가 변경 될 때마다 이벤트를 ElasticSearch로 푸시했습니다.Kibana : 필드의 top_hits 수를 표시하는 테이블을 만드는 방법
일정 기간 동안 상태가 다른 계정에 대한 여러 문서가 있습니다.
내 요구 사항은 각 account_id에 대한 최근 문서를 가져 와서 상태를 계산하는 것입니다.
SQL에 해당하는 "상태 별 상태 선택, 개수 (*), 상태 별 계정 그룹에서의 개수 (*)"
예 : 다음 로그
account_id: 1, status:delete, @timestamp: November 4th 2017, 18:42:09.445
account_id: 1, status:save, @timestamp: November 3rd 2017, 18:42:09.445
account_id: 1, status:draft, @timestamp: November 2nd 2017, 19:42:09.445
account_id: 2, status:draft, @timestamp: November 3rd 2017, 19:42:09.445
account_id: 3, status:save, @timestamp: November 4th 2017, 18:42:09.445
account_id: 3, status:draft, @timestamp: November 3rd 2017, 19:42:09.445
을 고려 출력은 다음과 같아야합니다
**status** **count**
delete 1
save 1
draft 1
ELK : 5.6