# TSVB - Gauage - Bucket Script 오류 문의 (Top Hit)

**URL:** <https://discuss.elastic.co/t/tsvb-gauage-bucket-script-top-hit/268296>\
**Category:** 한국어 질문 및 토론\
**Created:** [March 25, 2021, 6:50am UTC](https://discuss.elastic.co/t/tsvb-gauage-bucket-script-top-hit/268296 "2021-03-25T06:50:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![KANG](https://avatars.discourse-cdn.com/v4/letter/k/d6d6ee/32.png) [@KANG](https://discuss.elastic.co/u/KANG)\
**Post date:** [March 25, 2021, 6:50am UTC](https://discuss.elastic.co/t/tsvb-gauage-bucket-script-top-hit/268296/1 "2021-03-25T06:50:10Z")

</div>

안녕하세요.

Gauage를 활용하여 메모리 사용률을 Kibana에서 시각화 하려고합니다.

TSVB 활용 중 오류가 발생하여 해결방법에 대해 문의드립니다.

[구현내용]

메모리 사용률(%)  
메모리 사용량(memutilization) / 전체 메모리량(totalmem) \* 100

[설정내용]

TSVB - Gauage - Metris

1번 Aggregation : Top Hit - totalmem  
2번 Aggregation : Top Hit - memutilization  
3번 Aggregation : Bucket Script  
3-1 : A - Top Hit of totalmem  
3-2 : B - Top Hit of memutilization  
painless script : parmas.B / params.A

[오류 메세지]

The request for this panel failed  
buckets\_path must reference either a number value or a single value numeric metric aggregation

Filter Ratio로 구현을 해보다가 되지 않아, 구글링을 통해 Bucket Script로 가능하다고 하여 테스트 중인데 이상하게도 Aggregation을 Top Hit로 설정하면 위 메세지가 발생합니다.

혹시 위 방법 외에 두 개 데이터를 계산하여 Kibana로 뿌려줄 수 있는 방법이 있는지 궁금합니다.

---

<div class="post-metadata">

**Author:** ![insuk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/insuk/32/29396_2.png) [@insuk](https://discuss.elastic.co/u/insuk)\
**Post date:** [March 26, 2021, 12:52am UTC](https://discuss.elastic.co/t/tsvb-gauage-bucket-script-top-hit/268296/2 "2021-03-26T00:52:57Z")

</div>

일단, 어떤 인덱스에서 어떻게 수집한 데이터를 활용하고 계신지 이해를 해야 도움이 되겠습니다.

그리고 이해를 돕기 위한 스크린샷도 포함되면 좋겠습니다.

---

<div class="post-metadata">

**Author:** ![KANG](https://avatars.discourse-cdn.com/v4/letter/k/d6d6ee/32.png) [@KANG](https://discuss.elastic.co/u/KANG)\
**Post date:** [April 5, 2021, 4:48am UTC](https://discuss.elastic.co/t/tsvb-gauage-bucket-script-top-hit/268296/3 "2021-04-05T04:48:02Z")

</div>

Index pattern : snmp\_test\*

Field Name  
memutilization (Type : number / Format : Bytes)  
totalmem (Type : number / Format : Bytes)  
(Discover를 보면 데이터 값을 잘 불러와서 Visualization에서 각각 항목을 Gauge로 표현하는데 성공했습니다.)

궁극적으로 하고자하는 바는 대시보드 상에서 실시간 '메모리 사용률'을 확인하고자 합니다.

이때  
TSVB - Metrics에서  
Aggregation1 : Sum + Field : totalmem  
Aggregation2 : Sum + Field : memutilization으로 설정 후  
Bucket Script에 스크립트 설정하면 결과 값이 %로 잘 나오지만

Aggregation1,2를 Top Hit로 설정하면 스크린샷 같은 에러 메세지가 발생합니다.

 ![error_msg](https://us1.discourse-cdn.com/elastic/original/3X/8/d/8db98e5e1bef5da5e53e9f118545323fe90c88a7.jpeg)

---

<div class="post-metadata">

**Author:** ![insuk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/insuk/32/29396_2.png) [@insuk](https://discuss.elastic.co/u/insuk)\
**Post date:** [April 19, 2021, 8:58am UTC](https://discuss.elastic.co/t/tsvb-gauage-bucket-script-top-hit/268296/4 "2021-04-19T08:58:43Z")

</div>

> [@KANG](#):
>
> op Hit로 설정

자세한 정보 감사드립니다.

현재 원하시는 기능은 제공되지 않는 것으로 보입니다.  
아래 이슈 확인해보시면, TSVB에서는 bucket\_script aggregation 안에서 top\_hits를 사용할 수 없다고 하네요.

> <https://github.com/elastic/kibana/issues/44294>
>
> \*\*Kibana version:\*\* 7.0.1
> 
> \*\*Elasticsearch version:\*\* 7.0.1
> 
> \*\*Server OS ver…sion:\*\* CentOS 7
> 
> \*\*Browser version:\*\* Crome Version 75.0.3770.90 (Offizieller Build) (64-Bit)
> 
> \*\*Browser OS version:\*\* Windows Server 2016 Standard
> 
> \*\*Original install method (e.g. download page, yum, from source, etc.):\*\* openstack docker image
> 
> \*\*Describe the bug:\*\*
> 
> buckets\_path must reference either a number value or a single value numeric metric aggregation, got: org.elasticsearch.search.aggregations.bucket.filter.InternalFilter
> 
> This happens while designing a Gauge in the Visual Builder using two TopHit aggregations as a source for two Bucket Script variables.
> 
> The bucket script shall only do a simple thing "params.var1 / params.var2" but produces the above error.
> 
> \*\*Steps to reproduce:\*\*
> 1. Open Visual Builder
> 2. Create a new Visualisation and switch to Gauge
> 3. Create to TopHit aggregations of to vars from the same index
> 4. Add a bucket script using those vars like "params.var1 / params.var2"
> 5. The preview should now feature the same error as shown above.
> 
> \*\*Expected behavior:\*\*
> I dont think i fully understand Elastic/Kibana already and all of its terms, but to my understanding im only using two "single value numeric metric aggregation"s to try to have a dynamic gauge. So this according to some tutorial page i found should give me a working gauge.

제 생각에는 TSVB를 사용하시려면 두 가지 대안이 있어 보입니다.

1. 데이터를 어떻게 수집하고 계시는지 모르겠습니다만, 저희 제품으로 수집하고 계시면, 메모리 사용량도 별도 필드로 수집될 가능성이 있습니다. 확인해보세요.

2. 그렇지 않다면, snmp\_test\* 인덱스에 [스크립트 필드](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html)를 추가하셔서, 메모리 사용량 계산을 미리 한 필드를 지정하는 방법입니다.

아니면, TSVB대신 [Vega](https://www.elastic.co/guide/en/kibana/current/vega.html)를 사용하는 것도 방법이겠습니다.

참고하시기 바랍니다.

> [@KANG](#):
>
> buckets\_path must reference either a number value or a single value numeric metric aggregation

---

<div class="post-metadata">

**Author:** ![KANG](https://avatars.discourse-cdn.com/v4/letter/k/d6d6ee/32.png) [@KANG](https://discuss.elastic.co/u/KANG)\
**Post date:** [April 27, 2021, 5:10am UTC](https://discuss.elastic.co/t/tsvb-gauage-bucket-script-top-hit/268296/5 "2021-04-27T05:10:31Z")

</div>

답변 감사드립니다. bug라니 아쉽습니다ㅠ\_ㅠ

현재 진행하는 작업은 제안해주신 방식 중 2번 방식으로 진행을 해야할 것 같습니다.  
또 열심히 해보아야겠네요 ^^ 감사합니다 !

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 25, 2021, 5:10am UTC](https://discuss.elastic.co/t/tsvb-gauage-bucket-script-top-hit/268296/6 "2021-05-25T05:10:33Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
