Is it possible to perform an operation on fields from two different indexes?

These are my indexes:

stage-api-athena-fruitcount:

  • upload_time
  • [other fields]

stage-cloudwatch:

  • Timestamp
  • [other fields]

I want to perform the following action. Is it possible to do this operation on two separate indexes using either Kibana or Elasticsearch?

Timestamp - upload_time

Bump

I am still looking for an answer.

Elasticsearch does not support joins, which what you are suggesting seems to be.

What if the two fields were in the same index. Would subtract operation be possible?

That is generally still a join, so not possible.

I see, but I read something about script fields before. Have you used them? Do you think it would be useful in this scenario?

Scripts and scripted fields run in the context of a single document, so I do not see how it would help here. If you have a unique identifier that links these two entries, create a document with that as an ID and then update it so you get all data in a single document.

1 Like

By identifier, do you mean fields that are the same in both indexes? The two indexes both have customer_id and farm_id which are the same.

If that is what links them, then concatenate them and use that as a document id.

Thanks for your suggestion, I will look into this solution.