Store extra data in buckets that are indexed by GSIs

We’re planning to have a bucket with two kinds of objects:
key -> {
“field1” :…
“field2”:…
}

and

key -> {
“field3” :…
}

however we want to have GSIs over field1 and field2 only.

Should the second type of object (with field 3) be stored in the same bucket as the first type? Or would it be recommended to use two buckets.

My concern is if it’ll slow the indexing, or writes over the bucket i.e. if the indexer tries to evaluate if the second kind of object needs indexing as well.

We’re could be storing documents as many as 100k+ in these buckets

@couchbaseUser19, storing the documents in a single bucket should work fine for your use case. You can create partial index using “Where” clause to filter the unwanted documents. Details here.

The filtering is efficient and happens before the data is sent to the index service.

1 Like