How to create a scripted fields for data in two different indexes


We have data stored in 2 different indexes,. say index1 and index2. Here, we have created the index pattern as index*.
The, index1 has a fieldname - 'val' for a particular month. and
index2 also has a fieldname - 'val' for some other month. So, inorder to differentiate both the fields. we renamed index2 'val' field as "val2"., before pushing it to elasticsearch. Also, both fields are numeric datatype.

Now, we have 2 fields say 'val' and 'val2' in the index - 'index*', and trying to create a scripted field as doc['val'].value + doc['val2'].value. But, while visualizing the data in metric visualization, we are getting "visualization error".
Can someone suggest the solution for this...

Thanks in Advance.

Hi @Deepikakamalla,

As far as I can tell, that is not possible. Scripted-fields are submitted in the query to Elasticsearch, which hits only a single index.

I would continue this discussion in the Elasticsearch discuss channel (, or perhaps open an enhancement request in the Elasticsearch repo.

Ok, thanks.

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