1
votes

MarkLogic Version - 9

Consider - I have 3 collections with huge documents in it.

collection1: Order document count - 10M element - orderNumber

collection2: Inventory document count - 100M

collection3: Payment document count - 50M

Ex: We want to create a range index for element "orderNumber" for all the documents in collection1(Order). This is not a one-time thing and our code requires dynamic range index creation on different elements in the documents based on user operation.

For the element for which we are trying to create a range index, we already know which collection documents have that element. We are also not interested in that element if it's present in other collection documents.

So can we create a range index on element available in the specific collection instead of reindexing all the documents(10M + 100M + 50 M) available in MarkLogic?

Since this range index creation is triggered by user operation in UI we do not want the DB to massively slow down trying to index all the available documents in DB.

2

2 Answers

3
votes

No, MarkLogic indexes always apply to the entire database to which they belong.

You can use a path range index however. The indexer should be able to target Order documents only if the path is specific enough, saving on (re)index time, and memory.

HTH!

3
votes

From an application point of view there are two ways to slice this: (1) As Geert says, see if you can use a path range index and model your data to select just the documents that you want. (2) Index everything, but constrain uses of that index with collection queries.