Math/scoring/scripted fields question

Hi guys,

I want to create some sort of scoring mechanism on a visual and want to know if scripted fields are the way to do this.

I have documents that come in when a famous person gets a like, comment or a share of their post. I then want to create a scoring mechanism to calculate how popular they are (on a visual). So a like is not as valuable as a comment and a share is the most strong indicator of popularity. So I want 2 things:

  1. I want to create a number that will calculate across all events a number score of how popular each person is. In the end I'd have a visual that would list the top 5 popular people, where popularity is a single number created by an algorithm of something similar to: likes/10000 + comments/10 + shares = popularity.

  2. I want to create a chart that shows for each person, their distribution of likes, comments and shares. I can do this currently with a filtered bar chart but when there are 10000 likes 100 comments and 5 shares, I can't see any of the shares/comments compared to the likes because there are so many likes. So I'd like to normalize each of them so that graph is actually visually useful.

Would scripted fields deal with both of these use cases?

For (1) it makes sense to use a scripted field. Probably something to the effect if "if the type of the event is a like, return 1, if it's a comment, return 10, if it's a share, return 100". Then you could just use the sum of that scripted field and order by terms for the person name.

For (2), could you just use a data table instead of using a visualization?

Ok, thanks for your advice. That's a clever suggestion and I appreciate it! So for 1), is there any way you can think of that I can do things the other way around, either through JSON input in the visual, editing the vis_type data in the Management > saved objects > visualization under either visState or kibanaSavedObjectMeta.searchSourceJSON and adding a script in there to do some sort of calculation?

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