I have objects that look like:
{
...
sources: {
source_1: { [metadata about source_1] },
source_z: { [metadata about source_z] },
source_a: { [metadata about source_a] }
}
}
If a document has data from a source, the entry with that name exists. Otherwise it does not exist. eg this has only data from source_a:
{
...
sources: {
source_a: { [metadata about source_a] }
}
}
What index can help me speed up looking for documents which have data from a given source? To be more precise, I don't care what data that source contributed, only that it is included (there is an entry with that key in the sources object).
Should I make an index for each source, eg {"sources.source_z": 1}
?
Want to be most efficient, so as to not index all the data in the source, just the existence of it.