Ingest pipeline script field math

Hello,

I'm trying to create a ingest processor pipeline in kibana and could use some help. I'm trying to divide 2 values by each other which is the problem. Value 1 is an integer and Value 2 is a string. I'd like to get the cardinality/unique count of recurring strings before doing the division:

ctx.average_consumption = ctx.integer / ctx.unique_count_string

Any thoughts on how to accomplish this in Kibana?

Just bumping this.

Just bumping this

Hi @gentle_ghost

I am a bit unclear what you are trying to accomplish... an ingest pipeline is run on a "Per Document" basis so it will not understand / have access to aggregations across the index.. so unless that /unique count of recurring strings is part of the document that is currently being ingested you will need to take a different approach. Do you already have that field in the document?

Unfortunately, I'm just not sure how to accomplish this. The enhanced data table plugin would work for a computed column but is unavailable for the current version I'm on.

Essentially I'm looking for a column that is Column A/Column B where Column A = Sum Aggregation on number field and Column B = Unique Count on string field.

I'm uncertain how to populate a column or field that would contain that data.

If you can provide sample data and the end result I think we can work through how to do it. Or at least determine if it's possible.