Make it possible to disable flush event through configuration

This PR makes it possible again to disable the flush event. We are using a distributed way to index our entities which should not happen during postFlush. But there is no way to disable the behavior.