rules: prepare addition of new methods

THis patch prepares the addition of new method for Source by
factorizing the code.
elasticsearch: treat case where there is no data.