Unique document IDs per index or globally?

Hi,

I’m starting out with Manticore, and intend to use it in a multi-tenant setup, where each
index belongs to a different customer and has nothing to do with the other indexes
(belonging to other customers). Regarding that, I have a basic question:

The documentation says: “ALL DOCUMENT IDS MUST BE UNIQUE SIGNED POSITIVE NON-ZERO 64-BIT INTEGER NUMBERS”. Just to be 100% sure: does this mean per index, or globally across all indexes, even if one source always belongs to one index and those indexes have nothing to do with each other?

Since I’m using a dedicated MySQL database for each customer account, document IDs always
begin at 1 for each customer. Is it fine to create multiple sources in that case that
share document IDs? Or could Manticore potentially “mix up” those duplicate IDs and return
data from index customer_B even though I’m searching index customer_A?

Any help would be highly appreciated!

It’s per index. You need to think at this ID like a primary key. If indexes are never mixed in searches, it doesn’t matter.
However if for example you create an index for each customer, but you perform searches over all indexes, the IDs needs to be unique in this case. This is because when the engine tries to merge the results from indexes into a the final result, possible duplicate IDs will create problems.
Also if you use a single index with multiple sources, the IDs needs to be unique across the sources.
If you are in these cases and you don’t have an unique ID in the DB, you’ll need to generate one when inserting the data in the index. Another way is to use Real-Time index, as it can auto-generate it’s document id.

1 Like