Inter index operation


(Teddy) #1

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.


(David Pilato) #2

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?


(Teddy) #3

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


(David Pilato) #4

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


(Teddy) #5

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


(David Pilato) #6

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

(Teddy) #7

Can this be done in a single request?


(David Pilato) #8

No. Only if you change your modeling.


(system) #9

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