I have a terrible problem due to a high volume of data on children of my masters. I have 2 cases. 1st case a master object with a list that has 1000 records and 2nd case a master with a list that has one record. I would like to be able to do indexing dependency only for the second case. I thought of applying transient object as well, but again here it applies index to all the details.
@OneToMany(mappedBy = "field", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
@IndexedEmbedded(structure = ObjectStructure.NESTED, includePaths = {"id"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
private List<Object> list = new ArrayList<>();
....
@Transient
@IndexingDependency(derivedFrom = {
@ObjectPath(@PropertyValue(propertyName = "list"))
}, reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@IndexedEmbedded(includePaths = {"id")
private Object object;
public Object getObject () {
if (CollectionUtils.isNotNullOrEmpty(list)) {
return list.get(0);
}
return null;
}