Module: Elasticsearch::API::QueryRules::Actions
- Included in:
- QueryRulesClient
- Defined in:
- lib/elasticsearch/api/namespace/query_rules.rb,
lib/elasticsearch/api/actions/query_rules/test.rb,
lib/elasticsearch/api/actions/query_rules/get_rule.rb,
lib/elasticsearch/api/actions/query_rules/put_rule.rb,
lib/elasticsearch/api/actions/query_rules/delete_rule.rb,
lib/elasticsearch/api/actions/query_rules/get_ruleset.rb,
lib/elasticsearch/api/actions/query_rules/put_ruleset.rb,
lib/elasticsearch/api/actions/query_rules/list_rulesets.rb,
lib/elasticsearch/api/actions/query_rules/delete_ruleset.rb
Instance Method Summary collapse
-
#delete_rule(arguments = {}) ⇒ Object
Deletes an individual query rule within a ruleset.
-
#delete_ruleset(arguments = {}) ⇒ Object
Deletes a query ruleset.
-
#get_rule(arguments = {}) ⇒ Object
Returns the details about an individual query rule within a ruleset.
-
#get_ruleset(arguments = {}) ⇒ Object
Returns the details about a query ruleset.
-
#list_rulesets(arguments = {}) ⇒ Object
Lists query rulesets.
-
#put_rule(arguments = {}) ⇒ Object
Creates or updates a query rule within a ruleset.
-
#put_ruleset(arguments = {}) ⇒ Object
Creates or updates a query ruleset.
-
#test(arguments = {}) ⇒ Object
Tests a query ruleset to identify the rules that would match input criteria This functionality is Experimental and may be changed or removed completely in a future release.
Instance Method Details
#delete_rule(arguments = {}) ⇒ Object
Deletes an individual query rule within a ruleset.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/elasticsearch/api/actions/query_rules/delete_rule.rb', line 33 def delete_rule(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'query_rules.delete_rule' } defined_params = %i[ruleset_id rule_id].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'ruleset_id' missing" unless arguments[:ruleset_id] raise ArgumentError, "Required argument 'rule_id' missing" unless arguments[:rule_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _ruleset_id = arguments.delete(:ruleset_id) _rule_id = arguments.delete(:rule_id) method = Elasticsearch::API::HTTP_DELETE path = "_query_rules/#{Utils.__listify(_ruleset_id)}/_rule/#{Utils.__listify(_rule_id)}" params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#delete_ruleset(arguments = {}) ⇒ Object
Deletes a query ruleset.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/elasticsearch/api/actions/query_rules/delete_ruleset.rb', line 32 def delete_ruleset(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'query_rules.delete_ruleset' } defined_params = [:ruleset_id].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'ruleset_id' missing" unless arguments[:ruleset_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _ruleset_id = arguments.delete(:ruleset_id) method = Elasticsearch::API::HTTP_DELETE path = "_query_rules/#{Utils.__listify(_ruleset_id)}" params = Utils.process_params(arguments) if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found do Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end else Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end end |
#get_rule(arguments = {}) ⇒ Object
Returns the details about an individual query rule within a ruleset.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/elasticsearch/api/actions/query_rules/get_rule.rb', line 33 def get_rule(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'query_rules.get_rule' } defined_params = %i[ruleset_id rule_id].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'ruleset_id' missing" unless arguments[:ruleset_id] raise ArgumentError, "Required argument 'rule_id' missing" unless arguments[:rule_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _ruleset_id = arguments.delete(:ruleset_id) _rule_id = arguments.delete(:rule_id) method = Elasticsearch::API::HTTP_GET path = "_query_rules/#{Utils.__listify(_ruleset_id)}/_rule/#{Utils.__listify(_rule_id)}" params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_ruleset(arguments = {}) ⇒ Object
Returns the details about a query ruleset.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/elasticsearch/api/actions/query_rules/get_ruleset.rb', line 32 def get_ruleset(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'query_rules.get_ruleset' } defined_params = [:ruleset_id].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'ruleset_id' missing" unless arguments[:ruleset_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _ruleset_id = arguments.delete(:ruleset_id) method = Elasticsearch::API::HTTP_GET path = "_query_rules/#{Utils.__listify(_ruleset_id)}" params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#list_rulesets(arguments = {}) ⇒ Object
Lists query rulesets.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elasticsearch/api/actions/query_rules/list_rulesets.rb', line 33 def list_rulesets(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'query_rules.list_rulesets' } arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil method = Elasticsearch::API::HTTP_GET path = '_query_rules' params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_rule(arguments = {}) ⇒ Object
Creates or updates a query rule within a ruleset.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/elasticsearch/api/actions/query_rules/put_rule.rb', line 34 def put_rule(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'query_rules.put_rule' } defined_params = %i[ruleset_id rule_id].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] raise ArgumentError, "Required argument 'ruleset_id' missing" unless arguments[:ruleset_id] raise ArgumentError, "Required argument 'rule_id' missing" unless arguments[:rule_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _ruleset_id = arguments.delete(:ruleset_id) _rule_id = arguments.delete(:rule_id) method = Elasticsearch::API::HTTP_PUT path = "_query_rules/#{Utils.__listify(_ruleset_id)}/_rule/#{Utils.__listify(_rule_id)}" params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_ruleset(arguments = {}) ⇒ Object
Creates or updates a query ruleset.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/elasticsearch/api/actions/query_rules/put_ruleset.rb', line 33 def put_ruleset(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'query_rules.put_ruleset' } defined_params = [:ruleset_id].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] raise ArgumentError, "Required argument 'ruleset_id' missing" unless arguments[:ruleset_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _ruleset_id = arguments.delete(:ruleset_id) method = Elasticsearch::API::HTTP_PUT path = "_query_rules/#{Utils.__listify(_ruleset_id)}" params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#test(arguments = {}) ⇒ Object
Tests a query ruleset to identify the rules that would match input criteria This functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/elasticsearch/api/actions/query_rules/test.rb', line 37 def test(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'query_rules.test' } defined_params = [:ruleset_id].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] raise ArgumentError, "Required argument 'ruleset_id' missing" unless arguments[:ruleset_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _ruleset_id = arguments.delete(:ruleset_id) method = Elasticsearch::API::HTTP_POST path = "_query_rules/#{Utils.__listify(_ruleset_id)}/_test" params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |