How to store objects which are shared for another objects?

Hello!
I have object of 'A' which have references to rarely changed object of 'RarelyChanged' (for example, user context) and frequently changed object of 'FrequentlyChanged'. "Rarely changed" means the many 'A' objects will have reference to same 'RarelyChanged ' object. In another words 'RarelyChanged' objects are shared for 'A' objects.

public class A
{
   public string Name { get; set; }
   public RarelyChanged Rarely { get; set; }
   public FrequentlyChanged Frequently { get; set; }
}

public class RarelyChanged
{
   public string Login { get; set; }
   public string Address { get; set; }
   // many others props
}

public class FrequentlyChanged
{
   public Dictionary<string, object> Data { get; set; }
}

I don't want to store data of 'RarelyChanged' for every 'A' object and I want to filter, sort whole document ('A') by 'RarelyChanged' props.

How to store 'RarelyChanged' objects in the right way in Elastic Search?

I know about parent/child relations and nested object. But is this not my case, right?

Thank you!

Why? When working with a non-relational system this is a very common type of de-normalization. In this case I would say it is a solution worth looking into.

@Christian_Dahlqvist Shared objects might be:

  1. heavy
  2. same for many (millions) 'A' objects.
    I want consume memory more optimally.
    One thing: I won't update documents at all (read/write/delete only)

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