Multiply the values of two fields in the same index, but different lines


I'm trying to show billing information about a client in Kibana. I have created two indexes under the same index pattern to be able to see the data from both in the same dashboard. The first index represents a transaction, with many fields but the important are the ID and quantity. The second index is the user information, with private information, but the important is the same ID and the price. That index has only one line per user.

To show the price of a transaction, i need to multiply it's quantity by the price for that user in the user table. I can use the ID to choose the right price.

I tried to make a scripted field, but i don't seem to be able to refer to a different line.

Some guidance on how to achieve my price value, ether in a scripted field or just the total over a month in a visualisation would be great

thanks !

You will need to do that as you index the data, as it's essentially the same as a join, which Elasticsearch cannot do.

1 Like

Thanks a lot for your fast answer.
We have tested some things and your answer was the best solution. We have added the info needed to each line. We adapted the database to do so and the result is what we wanted.

1 Like

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