Module: OpenSearch::DSL::Search

Extended by:
Search
Included in:
Search
Defined in:
lib/opensearch/dsl/search.rb,
lib/opensearch/dsl/search/sort.rb,
lib/opensearch/dsl/search/query.rb,
lib/opensearch/dsl/search/filter.rb,
lib/opensearch/dsl/search/options.rb,
lib/opensearch/dsl/search/suggest.rb,
lib/opensearch/dsl/search/highlight.rb,
lib/opensearch/dsl/search/filters/or.rb,
lib/opensearch/dsl/search/aggregation.rb,
lib/opensearch/dsl/search/filters/and.rb,
lib/opensearch/dsl/search/filters/ids.rb,
lib/opensearch/dsl/search/filters/not.rb,
lib/opensearch/dsl/search/queries/ids.rb,
lib/opensearch/dsl/search/filters/bool.rb,
lib/opensearch/dsl/search/filters/term.rb,
lib/opensearch/dsl/search/filters/type.rb,
lib/opensearch/dsl/search/queries/bool.rb,
lib/opensearch/dsl/search/queries/term.rb,
lib/opensearch/dsl/search/filters/limit.rb,
lib/opensearch/dsl/search/filters/query.rb,
lib/opensearch/dsl/search/filters/range.rb,
lib/opensearch/dsl/search/filters/terms.rb,
lib/opensearch/dsl/search/queries/fuzzy.rb,
lib/opensearch/dsl/search/queries/match.rb,
lib/opensearch/dsl/search/queries/range.rb,
lib/opensearch/dsl/search/queries/terms.rb,
lib/opensearch/dsl/search/base_component.rb,
lib/opensearch/dsl/search/filters/exists.rb,
lib/opensearch/dsl/search/filters/nested.rb,
lib/opensearch/dsl/search/filters/prefix.rb,
lib/opensearch/dsl/search/filters/regexp.rb,
lib/opensearch/dsl/search/filters/script.rb,
lib/opensearch/dsl/search/queries/common.rb,
lib/opensearch/dsl/search/queries/exists.rb,
lib/opensearch/dsl/search/queries/nested.rb,
lib/opensearch/dsl/search/queries/prefix.rb,
lib/opensearch/dsl/search/queries/regexp.rb,
lib/opensearch/dsl/search/filters/indices.rb,
lib/opensearch/dsl/search/filters/missing.rb,
lib/opensearch/dsl/search/queries/dis_max.rb,
lib/opensearch/dsl/search/queries/indices.rb,
lib/opensearch/dsl/search/queries/span_or.rb,
lib/opensearch/dsl/search/aggregations/avg.rb,
lib/opensearch/dsl/search/aggregations/max.rb,
lib/opensearch/dsl/search/aggregations/min.rb,
lib/opensearch/dsl/search/aggregations/sum.rb,
lib/opensearch/dsl/search/queries/boosting.rb,
lib/opensearch/dsl/search/queries/filtered.rb,
lib/opensearch/dsl/search/queries/span_not.rb,
lib/opensearch/dsl/search/queries/template.rb,
lib/opensearch/dsl/search/queries/wildcard.rb,
lib/opensearch/dsl/search/filters/geo_shape.rb,
lib/opensearch/dsl/search/filters/has_child.rb,
lib/opensearch/dsl/search/filters/match_all.rb,
lib/opensearch/dsl/search/queries/geo_shape.rb,
lib/opensearch/dsl/search/queries/has_child.rb,
lib/opensearch/dsl/search/queries/match_all.rb,
lib/opensearch/dsl/search/queries/span_near.rb,
lib/opensearch/dsl/search/queries/span_term.rb,
lib/opensearch/dsl/search/aggregations/range.rb,
lib/opensearch/dsl/search/aggregations/stats.rb,
lib/opensearch/dsl/search/aggregations/terms.rb,
lib/opensearch/dsl/search/filters/has_parent.rb,
lib/opensearch/dsl/search/queries/has_parent.rb,
lib/opensearch/dsl/search/queries/span_first.rb,
lib/opensearch/dsl/search/queries/span_multi.rb,
lib/opensearch/dsl/search/aggregations/filter.rb,
lib/opensearch/dsl/search/aggregations/global.rb,
lib/opensearch/dsl/search/aggregations/nested.rb,
lib/opensearch/dsl/search/filters/geo_polygon.rb,
lib/opensearch/dsl/search/queries/multi_match.rb,
lib/opensearch/dsl/search/aggregations/filters.rb,
lib/opensearch/dsl/search/aggregations/missing.rb,
lib/opensearch/dsl/search/filters/geo_distance.rb,
lib/opensearch/dsl/search/filters/geohash_cell.rb,
lib/opensearch/dsl/search/queries/match_phrase.rb,
lib/opensearch/dsl/search/queries/query_string.rb,
lib/opensearch/dsl/search/queries/top_children.rb,
lib/opensearch/dsl/search/aggregations/children.rb,
lib/opensearch/dsl/search/aggregations/ip_range.rb,
lib/opensearch/dsl/search/aggregations/top_hits.rb,
lib/opensearch/dsl/search/aggregations/composite.rb,
lib/opensearch/dsl/search/aggregations/histogram.rb,
lib/opensearch/dsl/search/queries/constant_score.rb,
lib/opensearch/dsl/search/queries/function_score.rb,
lib/opensearch/dsl/search/queries/more_like_this.rb,
lib/opensearch/dsl/search/aggregations/date_range.rb,
lib/opensearch/dsl/search/aggregations/geo_bounds.rb,
lib/opensearch/dsl/search/queries/fuzzy_like_this.rb,
lib/opensearch/dsl/search/aggregations/cardinality.rb,
lib/opensearch/dsl/search/aggregations/percentiles.rb,
lib/opensearch/dsl/search/aggregations/value_count.rb,
lib/opensearch/dsl/search/filters/geo_bounding_box.rb,
lib/opensearch/dsl/search/aggregations/geo_distance.rb,
lib/opensearch/dsl/search/aggregations/geohash_grid.rb,
lib/opensearch/dsl/search/base_aggregation_component.rb,
lib/opensearch/dsl/search/filters/geo_distance_range.rb,
lib/opensearch/dsl/search/aggregations/date_histogram.rb,
lib/opensearch/dsl/search/aggregations/extended_stats.rb,
lib/opensearch/dsl/search/aggregations/reverse_nested.rb,
lib/opensearch/dsl/search/queries/match_phrase_prefix.rb,
lib/opensearch/dsl/search/queries/simple_query_string.rb,
lib/opensearch/dsl/search/aggregations/scripted_metric.rb,
lib/opensearch/dsl/search/aggregations/percentile_ranks.rb,
lib/opensearch/dsl/search/queries/fuzzy_like_this_field.rb,
lib/opensearch/dsl/search/aggregations/significant_terms.rb,
lib/opensearch/dsl/search/base_compound_filter_component.rb,
lib/opensearch/dsl/search/aggregations/pipeline/avg_bucket.rb,
lib/opensearch/dsl/search/aggregations/pipeline/derivative.rb,
lib/opensearch/dsl/search/aggregations/pipeline/max_bucket.rb,
lib/opensearch/dsl/search/aggregations/pipeline/min_bucket.rb,
lib/opensearch/dsl/search/aggregations/pipeline/moving_avg.rb,
lib/opensearch/dsl/search/aggregations/pipeline/sum_bucket.rb,
lib/opensearch/dsl/search/aggregations/pipeline/bucket_sort.rb,
lib/opensearch/dsl/search/aggregations/pipeline/serial_diff.rb,
lib/opensearch/dsl/search/aggregations/pipeline/stats_bucket.rb,
lib/opensearch/dsl/search/aggregations/pipeline/bucket_script.rb,
lib/opensearch/dsl/search/aggregations/pipeline/cumulative_sum.rb,
lib/opensearch/dsl/search/aggregations/pipeline/bucket_selector.rb,
lib/opensearch/dsl/search/aggregations/pipeline/percentiles_bucket.rb,
lib/opensearch/dsl/search/aggregations/pipeline/extended_stats_bucket.rb

Overview

Provides DSL methods for building the search definition (queries, filters, aggregations, sorting, etc)

Defined Under Namespace

Modules: Aggregations, BaseAggregationComponent, BaseComponent, BaseCompoundFilterComponent, Filters, Queries Classes: Aggregation, AggregationsCollection, Filter, Highlight, Options, Query, Search, Sort, Suggest

Instance Method Summary collapse

Instance Method Details

#search(*args, &block) ⇒ Object

Initialize a new Search object

Examples:

Building a search definition declaratively


definition = search do
  query do
    match title: 'test'
  end
end
definition.to_hash
=> {:query=>{:match=>{:title=>"test"}}}

Using the class imperatively


definition = Search.new
query = Queries::Match.new title: 'test'
definition.query query
definition.to_hash
# => {:query=>{:match=>{:title=>"test"}}}


56
57
58
# File 'lib/opensearch/dsl/search.rb', line 56

def search(*args, &block)
  Search.new(*args, &block)
end