When you say roll your own , you mean , create a single field by concatenation so that the result is unique ? Like USER_RECORD_12334 ?
On Friday, April 19, 2019, Erick Erickson <erickerick...@gmail.com> wrote: > Basically you have to roll your own. You could do this when you assemble > the document on the client or use an UpdateRequestProcessor. If the latter, > by very, very sure you get it in the right place, specifically _before_ the > doc is routed. > > But I’d just assemble it on the client when I created the doc. > > Best, > Erick > > > On Apr 19, 2019, at 10:40 AM, Vivekanand <askhead...@gmail.com> wrote: > > > > Hello, > > > > > > > > I have a use case like below. > > > > > > > > *USE CASE* > > > > I have a document with fields like > > > > > > > > Id, > > > > Id_type, > > > > Field_1. > > > > Filed_2 > > > > > > > > 2 sample messages will look like > > > > > > > > { > > > > "id": "12334", > > > > "id_type": "USER_RECORD", > > > > "field_1": null, > > > > "field_2": null > > > > } > > > > > > > > > > > > { > > > > "id": "31321", > > > > "id_type": "OWNER_RECORD", > > > > "field_1": null, > > > > "field_2": null > > > > } > > > > > > > > > > > > *QUESTIONS* > > > > > > > > I’d like to define the unique key as a compound key from fields *id* and > > *id_type* > > > > 1. Could someone give me an example of how to do this ? Or point to the > > relevant section in the docs? > > 2. Is this the best way to define a compound primary key ? Is there a > > more efficient way ? > > > > > > > > *Regards,* > > > > *Vivek* > >