Average number of fields per another field

(Pardha Saradhi) #1

I have two fields in elastic search document, item_id, package_id, and creation_time. They are in a one to may relationship ( 1 item_id -> many package_id)

I want to display the (number of unique package_id/ unique number of item_id) in buckets based on creation_time.

Is this possible in kibana (version 5.5.1)? I am able to get the unique count of item_id and unique count of package_id and split them into buckets. I have no idea how to divide them (items/packages). Please help.

(Lukas Olson) #2

Sounds like the easiest thing here might be to create a scripted field that combines them, then do a unique count based on that.

Something like:

doc['item_id.raw'].value + '|' + doc['package_id.raw'].value

(Pardha Saradhi) #3

Created a scripted filed like you mentioned. But it is not visible in the drop down of Time series builder when I select cardinality.
Is this because item_id is a integer and package_id is a string?

(Lionel Froment) #4

Hi, we recently released a Kibana plugin that should do the job. Check it out there https://github.com/datasweet-fr/kibana-datasweet-formula

Compatible with 5.6 and upward.

(Lukas Olson) #5

Ahh, unfortunately TSVB doesn't support scripted fields :frowning:

Could you index this field instead?

(system) #6

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