Inter index operation

Lets say, I have 2 indices.
IndexA and IndexB.

IndexA has:
name and id.

IndexB has:
id and salary

I need to have name and corresponding salary to the same ID.

If you want one single document as a result, that won't be possible as elasticsearch does not support joins but if you want to get both documents, then that's a basic search across multiple indices.

What is exactly your need?

1 Like

If id from IndexA is equal to id from IndexB then increment the salary for that id by 300

But does your data look like? Why do you have 2 indices?

The index is given as it is.
We need to perform operations on given indices.

If you can't change the model to something which looks like a better practice, then you need to solve most likely all that on your application level, like:

  • run a scroll query on the first index and extract all the ids
  • run some bulk updates for each id to increase the value

Can this be done in a single request?

No. Only if you change your modeling.

1 Like

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