Modeling indices to mimic many to one relationships

Hi, I doing sync data to es 6.2 from postgres database and got some trouble modeling it. I have this situation:
3 models A, B, C
We want to search field from that 3 model and has result as model B look alike. Those are have relationship as A(1) - B(n), C(1) - B(n).
So if I have a text 'andy' from all 3 model the result would be:

  • all result of B that has text 'andy',
  • all result of B "belong to" A which has text 'andy'
  • all result of B "belong to" C which has text 'andy'

How I should modeling my indices so that I can search and paginate the result?

Right now I model it as one index: A as parent, B as Child, C is stored nested in B. It work quite ok with inner hit query. It has some cons relate to concurrent sync data.

But I'm wonder if is there any better way to do this (and how to update docs data)

What is the size of these entities and the expected cardinality between them? How frequently are they updated?

  • The size is around 50kb (I dump them as json string and calculate using getsize)
  • The cardinal is around <20 at this moment: 1 A has max 20 B, 1 C has max 5 B
  • They got update frequently, especially C. B will be updated when C is updated but it is not follow the order C first then B

Thanks.

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