if query.is_a?(Hash)
          # Some http libraries cannot submit get requests with content, so if query is a hash, post it instead (assume a query hash is using the query dsl)
          response = request(:post, {:index => index, :type => type, :op => "_count"}, options, encoder.encode(query))
        else
          response = request(:get, {:index => index, :type => type, :op => "_count"}, options.merge(:q => query))