elasticsearch: use isinstance() instead of type() is klass