Index list of entities, but knowing only ID of entities

Hey,

well the more straightforward way would be to change the mapping to have

private Set<Pilot> pilots = new HashSet<>();

That way, you’ll be working with @IndexedEmbedded as usual. But I suspect you cannot do that for some reason?

If that’s so, you may want to look at this example in the documentation Hibernate Search 7.2.1.Final: Reference Documentation related to the bridges and how you can access ORM’s session. Alternatively, you can also see this section about injecting beans Hibernate Search 7.2.1.Final: Reference Documentation

You’d have to implement and use a bridge (Hibernate Search 7.2.1.Final: Reference Documentation)
But then, since you only have an id you won’t be able to define dependencies, so when your Pilot changes that change won’t get reflected in this index …

Hence changing the mapping option would make it much-much simpler :wink: