Class: OpenSearch::DSL::Search::Aggregations::TopHits

Inherits:
Object
  • Object
show all
Includes:
BaseComponent
Defined in:
lib/opensearch/dsl/search/aggregations/top_hits.rb

Overview

A metric aggregator which returns the most relevant documents per bucket

Examples:


search do
  aggregation :tags do
    terms do
      field 'tags'

      aggregation :top_hits do
        top_hits sort: [ clicks: { order: 'desc' } ], _source: { include: 'title' }
      end
    end
  end
end

See Also:

Method Summary

Methods included from BaseComponent

included, #initialize