Transaction consistency and data integrity in flat index


(Sankalp Sood) #1

Hi, to avoid nesting, I made a flat index by combining all the unique ids of all the nested objects.
Suppose we have an object A which we has one to many relationship with B which further . Now suppose we have 50,000 records of C for a specific ID of B, so basically we have 50,000 different documents as we didn't do nesting. Now if we change any field of B ex. B.name, then it will change for all 50,000 docs. Between this time if person also changes A.name , then it will change it for 50,000 docs .. Will this effect data integrity?
In this transaction time if we change multiple things by different update queries, will this effect data integrity?
or data integrity is much better in nesting?


(Christian Dahlqvist) #2

The modified documents will be available for search as they are published to segments, which will typically be spread out over time as different shards refresh at different times.

If you have a constant flow of changes it is hard to control this. If you however perform updates periodically in bulk, you might be able to disable automatic refreshes and try to instead trigger one when the full update has completed, thereby making all the data available (almost) at once.