fbaligand / kibana-enhanced-table

Kibana visualization like a Data Table, but with enhanced features like computed columns, filter bar, and “Split Cols” bucket
Apache License 2.0
309 stars 64 forks source link

Can't sum up the values with top_hits aggragation #201

Open yjaigu opened 3 years ago

yjaigu commented 3 years ago

Hi,

in Kibana 7.11.2 and kibana-enhanced-table v1.11.1, it doesn't sum up the values in a top_hit metric, aggregated with "concatenate" (with a simple split row bucket). Only "count" is actually working as a total function. It is annoying since I use the total of these columns to compute other colums total.

Example :

fbaligand commented 3 years ago

Indeed, I reproduce the issue. I will try to fix it in next release.

yjaigu commented 3 years ago

thanks Fabien !

Le ven. 9 avr. 2021 à 16:23, Fabien Baligand @.***> a écrit :

Indeed, I reproduce the issue. I will try to fix it in next release.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fbaligand/kibana-enhanced-table/issues/201#issuecomment-816719399, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEN5TFUNILHM3DASS2L43TTH4EV7ANCNFSM42RFR5CA .

Sandy381 commented 1 year ago

Hi @fbaligand ,

This is still an issue in Opensearch 2.2.0.

I'm unable to sum Top hit aggregations whereas I'm able to do so in data table.

Data table: Data-table_total

Enhanced table: Screenshot 2022-11-30 at 2 04 30 PM

Need your help.

fbaligand commented 1 year ago

Well, I just did some tests, and I'm able to make it work: if field is numeric, and you use Average, Max, Min or Sum in "Aggregate with" setting, then Total feature works.

fbaligand commented 1 year ago

@yjaigu @Sandy381 Could you try to use Average, Max, Min or Sum in “Aggregate with” setting?

Sandy381 commented 1 year ago

It works with Max, Min & Sum aggregations. No issues. For now I'm using Sum for my visualization & then put control filter visualization on top of my table visualization and filter as i need. But in some cases, I may want latest values. In this case it will not add up. Thanks for checking :)

fbaligand commented 1 year ago

Well, in "Top Hit" metric, if you set 1 in Size setting, whatever you use Average, Max, Min Sum or Concatenate aggregation, you will get exactly the same displayed result. Moreover, I just tested Data Table with a "Top Hit" metric with size=2 and Aggregate with=Concatenate. The total (sum) is the value of the first item, so it is wrong. It should be the sum of both items.

Demonstration with Data Table: image

prakashgupta1605 commented 1 year ago

Hi Fabien, have you implemented the solution for this issue? I have the similar requirement . I am trying to create a metric visualization where I want to sum the top hits on an aggregation. I am using Kibana version 7.17 but I don't see the top hit option in 8.10 as well if I select bucket aggregation.

fbaligand commented 1 year ago

Hi, « top hit » aggregation is a « metric » aggregation, so you can’t use it in « bucket » aggregations. Then, as explained in previous comments, if you use top hit aggregation with size=1 and function=max, then the « total » feature will work.

If it still not works for you, could you share your settings as initial description does (or share your settings screenshot) ?