trying to make elasticsearch logic abstraction