We're updating the issue view to help you get more done. 

Support for ID predicates when multi-tenancy is enabled


The ID predicates introduced in are unlikely to work when multi-tenancy is enabled.

In particular, there will be a problem in the Elasticsearch integration: the predicate is built without any information about the current tenant (no session context), but the actual ID used in Elasticsearch depends on the current ID; it's actually a concatenation of the tenant ID and the entity ID.

One obvious solution would be to give access to the session context to the predicate builders, but that would mean that SearchPredicate objects cannot be reliably used accross different sessions, so I'd rather avoid that.

Alternatively, we could make the Elasticsearch predicate builders closer to the Lucene ones, passing context information to the build() method and making sure that they return a new JsonObject each time the build() method is invoked. This would allow us to just hold a reference to the builder in ElasticsearchSearchPredicate, and to delay the generation of actual JSON to a time when we actually know about the current tenant ID. However, that would require a lot of changes, and could make some predicate builders much more complex, since they wouldn't be able to store their data in a JsonObject, but would have to store the information in dedicated fields, and only create (and populate) a JsonObject when build() is called.

Maybe there are other solutions... TBD.





Yoann Rodière


Yoann Rodière



Suitable for new contributors


Feedback Requested



Fix versions