Module: Elasticsearch::DSL::Search

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

See Also:



48
49
50
# File 'lib/elasticsearch/dsl/search.rb', line 48

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