Trying to decide to use indices or types

Hi

Use case: I'm trying to separate my documents for each client. As in, one client may only be interested in documents that only have ___ value for ___ field. Currently, I have a main index with all documents, and then reindexing documents that the client is interested in to their own index.

So, all documents have the same mapping. Just want to separate them.

Should I be creating types for each user instead.

I read this:
"If you have many documents for each type, then the overhead of Lucene indices will be easily amortized so you can safely use indices, with fewer shards than the default of 5 if necessary"

but it still isnt clear

I guess you have in your index a field like clientId or something.

You could use filtered aliases instead of reindexing IMHO.

We currently don't. I've thought about this though:

Create a field clientIDs that contains a set of client IDs. Then, for the dashboards that we are providing clients, filter by client ID's. But, then, for the API we are providing our clients, how would you recommend filtering aliases?

Very helpful, thanks

how would you recommend filtering aliases?

Create a clientA alias which points to your indices. And filter this alias with a term query on the clientId field.

More details at Index Aliases | Elasticsearch Reference [6.2] | Elastic

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