Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to version 0.1.12 to change class and method names search #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ spec/reports
test/tmp
test/version_tmp
tmp
.idea/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ Let's build the same definition in a more imperative fashion:
require 'elasticsearch/dsl'
include Elasticsearch::DSL

definition = Search::Search.new
definition.query = Search::Queries::Match.new title: 'test'
definition = Inquiry::Inquiry.new
definition.query = Inquiry::Queries::Match.new title: 'test'

definition.to_hash
# => { query: { match: { title: "test"} } }
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ namespace :generate do
module Test
module #{module_name}
class #{class_name}Test < ::Elasticsearch::Test::UnitTestCase
include Elasticsearch::DSL::Search::#{module_name}
include Elasticsearch::DSL::Inquiry::#{module_name}

context "#{class_name} #{options[:type]}" do
subject { #{class_name}.new }
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch-dsl.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Gem::Specification.new do |s|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
s.require_paths = ['lib']

s.extra_rdoc_files = [ 'README.md', 'LICENSE.txt' ]
s.extra_rdoc_files = [ 'README.md']
s.rdoc_options = [ '--charset=UTF-8' ]

s.required_ruby_version = '>= 2.5'
Expand Down
32 changes: 16 additions & 16 deletions lib/elasticsearch/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@
require 'elasticsearch/dsl/version'

require 'elasticsearch/dsl/utils'
require 'elasticsearch/dsl/search/base_component'
require 'elasticsearch/dsl/search/base_compound_filter_component'
require 'elasticsearch/dsl/search/base_aggregation_component'
require 'elasticsearch/dsl/search/query'
require 'elasticsearch/dsl/search/collapse'
require 'elasticsearch/dsl/search/filter'
require 'elasticsearch/dsl/search/aggregation'
require 'elasticsearch/dsl/search/highlight'
require 'elasticsearch/dsl/search/sort'
require 'elasticsearch/dsl/search/options'
require 'elasticsearch/dsl/search/suggest'
require 'elasticsearch/dsl/inquiry/base_component'
require 'elasticsearch/dsl/inquiry/base_compound_filter_component'
require 'elasticsearch/dsl/inquiry/base_aggregation_component'
require 'elasticsearch/dsl/inquiry/query'
require 'elasticsearch/dsl/inquiry/collapse'
require 'elasticsearch/dsl/inquiry/filter'
require 'elasticsearch/dsl/inquiry/aggregation'
require 'elasticsearch/dsl/inquiry/highlight'
require 'elasticsearch/dsl/inquiry/sort'
require 'elasticsearch/dsl/inquiry/options'
require 'elasticsearch/dsl/inquiry/suggest'

Dir[ File.expand_path('../dsl/search/queries/**/*.rb', __FILE__) ].each { |f| require f }
Dir[ File.expand_path('../dsl/search/filters/**/*.rb', __FILE__) ].each { |f| require f }
Dir[ File.expand_path('../dsl/search/aggregations/**/*.rb', __FILE__) ].each { |f| require f }
Dir[ File.expand_path('../dsl/inquiry/queries/**/*.rb', __FILE__) ].each { |f| require f }
Dir[ File.expand_path('../dsl/inquiry/filters/**/*.rb', __FILE__) ].each { |f| require f }
Dir[ File.expand_path('../dsl/inquiry/aggregations/**/*.rb', __FILE__) ].each { |f| require f }

require 'elasticsearch/dsl/search'
require 'elasticsearch/dsl/inquiry'

module Elasticsearch

Expand All @@ -59,7 +59,7 @@ module Elasticsearch
#
module DSL
def self.included(base)
base.__send__ :include, Elasticsearch::DSL::Search
base.__send__ :include, Elasticsearch::DSL::Inquiry
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module DSL
# Provides DSL methods for building the search definition
# (queries, filters, aggregations, sorting, etc)
#
module Search
module Inquiry

# Initialize a new Search object
#
Expand All @@ -37,7 +37,7 @@ module Search
#
# @example Using the class imperatively
#
# definition = Search.new
# definition = Inquiry.new
# query = Queries::Match.new title: 'test'
# definition.query query
# definition.to_hash
Expand All @@ -46,14 +46,14 @@ module Search
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search.html
#
def search(*args, &block)
Search.new(*args, &block)
Inquiry.new(*args, &block)
end

extend self

# Wraps the whole search definition (queries, filters, aggregations, sorting, etc)
#
class Search
class Inquiry
attr_reader :aggregations

def initialize(*args, &block)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry

# Contains the classes for Elasticsearch aggregations
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A single-value metric aggregation which returns the average of numeric values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A single-value metric aggregation which returns the approximate count of distinct values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A single-bucket aggregation which allows to aggregate from buckets on parent documents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations
#
# A multi-bucket aggregation that creates composite buckets from different sources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A multi-bucket aggregation which returns a histogram for date fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A multi-bucket aggregation which returns document counts for custom date ranges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A multi-value metrics aggregation which returns the extended statistical information on numeric values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# Defines a single bucket with documents matching the provided filter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A multi-bucket aggregation which defines multiple buckets matching the provided filters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# An aggregation which will calculate the smallest bounding box required to encapsulate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A multi-bucket aggregation which will return document counts for distance perimeters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A multi-bucket aggregation which will return document counts for geohash grid cells
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# Defines a single bucket of all the documents matching a query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A multi-bucket aggregation which returns document counts for a defined numerical interval
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A multi-bucket aggregation which returns document counts for defined IP ranges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A single-value metric aggregation which returns the maximum value from numeric values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A single-value metric aggregation which returns the minimum value from numeric values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A single bucket aggregation that creates a bucket of all documents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A single-bucket aggregation which allows to aggregate on nested fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A multi-value metrics aggregation which calculates percentile ranks on numeric values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A multi-value metrics aggregation which calculates percentiles on numeric values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A sibling pipeline aggregation which calculates the (mean) average value of a specified metric in a sibling aggregation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A parent pipeline aggregation which executes a script which can perform per bucket computations on specified metrics in the parent multi-bucket aggregation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A parent pipeline aggregation which executes a script which determines whether the current bucket will be retained in the parent multi-bucket aggregation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A parent pipeline aggregation which sorts the buckets of its parent multi-bucket aggregation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A parent pipeline aggregation which calculates the cumulative sum of a specified metric in a parent histogram (or date_histogram) aggregation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A parent pipeline aggregation which calculates the derivative of a specified metric in a parent histogram (or date_histogram) aggregation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. The specified metric must be numeric and the sibling aggregation must be a multi-bucket aggregation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A sibling pipeline aggregation which identifies the bucket(s) with the maximum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module Elasticsearch
module DSL
module Search
module Inquiry
module Aggregations

# A sibling pipeline aggregation which identifies the bucket(s) with the minimum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s).
Expand Down
Loading