Sha256: 28b05df97c272ccb32c864413ebe27decf223e0adabf1f0f4fbe40bcc3ec3c61

Contents?: true

Size: 403 Bytes

Versions: 12

Compression:

Stored size: 403 Bytes

Contents

module Elastic::Shims
  class Reducing < Base
    def handle_result(_raw, _formatter)
      result = super

      case result
      when Elastic::Results::Root
        result.aggregations.first.last.as_value
      when Elastic::Results::GroupedResult
        result.map_to_group { |b| b.first.last }
      else
        raise "unable to reduce result of type #{result.class}"
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
elastic-rails-0.8.5 lib/elastic/shims/reducing.rb
elastic-rails-0.8.4 lib/elastic/shims/reducing.rb
elastic-rails-0.8.3 lib/elastic/shims/reducing.rb
elastic-rails-0.8.2 lib/elastic/shims/reducing.rb
elastic-rails-0.8.1 lib/elastic/shims/reducing.rb
elastic-rails-0.8.0 lib/elastic/shims/reducing.rb
elastic-rails-0.7.0 lib/elastic/shims/reducing.rb
elastic-rails-0.6.4 lib/elastic/shims/reducing.rb
elastic-rails-0.6.3 lib/elastic/shims/reducing.rb
elastic-rails-0.6.2 lib/elastic/shims/reducing.rb
elastic-rails-0.6.1 lib/elastic/shims/reducing.rb
elastic-rails-0.6.0 lib/elastic/shims/reducing.rb