# Perform mathematical functions from two index in Kibana

**URL:** <https://discuss.elastic.co/t/perform-mathematical-functions-from-two-index-in-kibana/251972>\
**Category:** Kibana\
**Created:** [October 13, 2020, 10:15pm UTC](https://discuss.elastic.co/t/perform-mathematical-functions-from-two-index-in-kibana/251972 "2020-10-13T22:15:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibras](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@ibras](https://discuss.elastic.co/u/ibras)\
**Post date:** [October 13, 2020, 10:15pm UTC](https://discuss.elastic.co/t/perform-mathematical-functions-from-two-index-in-kibana/251972/1 "2020-10-13T22:15:41Z")

</div>

Hello,  
I am trying to perform a multiplication functions between two fields in different index in Kibana.

My first index looks like :

My first index :

```auto
  {
           "_index": "first_index",
           "_type": "type_1",
           "_id": "c7086175a8d312b47c62949f635f0c9164325ede973b09b9c3905ad7824bcc6d",
           "_score": 1.0,
           "_source": {
             "amount": 0.43616541,
             "date": "2020-10-12T20:28:05.000Z"
           }
         }

```

```
My seconde index

```

```auto
   {
            "_index": "second_index",
            "_type": "type_2",
            "_id": "id",
            "_score": 1.0,
            "_source": {
              "rate": 0.43616541,
              "date": "2020-10-12T20:28:05.000Z"
            }
          }

```

> I created in Kibana an index pattern who regourps both indexes but i don"t know how to use both field rate and amount, to create a visualization that contains the amount with specified rate.

the multiplication should be based on date.

Thanks

---

<div class="post-metadata">

**Author:** ![AClerk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aclerk/32/55297_2.png) [@AClerk](https://discuss.elastic.co/u/AClerk)\
**Post date:** [October 14, 2020, 12:24am UTC](https://discuss.elastic.co/t/perform-mathematical-functions-from-two-index-in-kibana/251972/2 "2020-10-14T00:24:27Z")

</div>

Not sure it is possible.  
AFAIK You need both fields in the same doc.

---

<div class="post-metadata">

**Author:** ![mastersmit](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@mastersmit](https://discuss.elastic.co/u/mastersmit)\
**Post date:** [October 14, 2020, 1:11am UTC](https://discuss.elastic.co/t/perform-mathematical-functions-from-two-index-in-kibana/251972/3 "2020-10-14T01:11:52Z")

</div>

Is there any link between two except the date? If thats the case, will there be only two entry per day?

Also, if both the data is coming via the logstash, you can use agregate of logstash to combine the data related via a unqiue link(id)

---

<div class="post-metadata">

**Author:** ![ibras](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@ibras](https://discuss.elastic.co/u/ibras)\
**Post date:** [October 14, 2020, 8:33am UTC](https://discuss.elastic.co/t/perform-mathematical-functions-from-two-index-in-kibana/251972/4 "2020-10-14T08:33:57Z")

</div>

Nope, the only link between both index is The date, also data is coming from different storm bolts in different nodes.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [October 14, 2020, 8:37am UTC](https://discuss.elastic.co/t/perform-mathematical-functions-from-two-index-in-kibana/251972/5 "2020-10-14T08:37:07Z")

</div>

If the date is always a perfect match, you could use a transform ([https://www.elastic.co/guide/en/elasticsearch/reference/current/transforms.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/transforms.html)) to "join" both indices together. You would end up with a single document containing both rate and amount.

For time based data it's also possible to set up a continuously running transform job.

---

<div class="post-metadata">

**Author:** ![ibras](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@ibras](https://discuss.elastic.co/u/ibras)\
**Post date:** [October 15, 2020, 11:33pm UTC](https://discuss.elastic.co/t/perform-mathematical-functions-from-two-index-in-kibana/251972/6 "2020-10-15T23:33:33Z")

</div>

Thanks a lot @flash1293, that works perfect with some combination with scripted fields and saved search i could have the proper visualations I needed

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 12, 2020, 11:33pm UTC](https://discuss.elastic.co/t/perform-mathematical-functions-from-two-index-in-kibana/251972/7 "2020-11-12T23:33:49Z")

</div>

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