Module: Elasticsearch::API::Synonyms::Actions
- Included in:
- SynonymsClient
- Defined in:
- lib/elasticsearch/api/namespace/synonyms.rb,
lib/elasticsearch/api/actions/synonyms/get_synonym.rb,
lib/elasticsearch/api/actions/synonyms/put_synonym.rb,
lib/elasticsearch/api/actions/synonyms/delete_synonym.rb,
lib/elasticsearch/api/actions/synonyms/get_synonym_rule.rb,
lib/elasticsearch/api/actions/synonyms/put_synonym_rule.rb,
lib/elasticsearch/api/actions/synonyms/get_synonyms_sets.rb,
lib/elasticsearch/api/actions/synonyms/delete_synonym_rule.rb
Instance Method Summary collapse
-
#delete_synonym(arguments = {}) ⇒ Object
Deletes a synonym set.
-
#delete_synonym_rule(arguments = {}) ⇒ Object
Deletes a synonym rule in a synonym set.
-
#get_synonym(arguments = {}) ⇒ Object
Retrieves a synonym set.
-
#get_synonym_rule(arguments = {}) ⇒ Object
Retrieves a synonym rule from a synonym set.
-
#get_synonyms_sets(arguments = {}) ⇒ Object
Retrieves a summary of all defined synonym sets.
-
#put_synonym(arguments = {}) ⇒ Object
Creates or updates a synonyms set.
-
#put_synonym_rule(arguments = {}) ⇒ Object
Creates or updates a synonym rule in a synonym set.
Instance Method Details
#delete_synonym(arguments = {}) ⇒ Object
Deletes a synonym set
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/synonyms/delete_synonym.rb', line 32 def delete_synonym(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'synonyms.delete_synonym' } defined_params = [: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 'id' missing" unless arguments[:id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _id = arguments.delete(:id) method = Elasticsearch::API::HTTP_DELETE path = "_synonyms/#{Utils.__listify(_id)}" params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#delete_synonym_rule(arguments = {}) ⇒ Object
Deletes a synonym rule in a synonym set
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/synonyms/delete_synonym_rule.rb', line 33 def delete_synonym_rule(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'synonyms.delete_synonym_rule' } defined_params = %i[set_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 'set_id' missing" unless arguments[:set_id] raise ArgumentError, "Required argument 'rule_id' missing" unless arguments[:rule_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _set_id = arguments.delete(:set_id) _rule_id = arguments.delete(:rule_id) method = Elasticsearch::API::HTTP_DELETE path = "_synonyms/#{Utils.__listify(_set_id)}/#{Utils.__listify(_rule_id)}" params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_synonym(arguments = {}) ⇒ Object
Retrieves a synonym set
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/synonyms/get_synonym.rb', line 34 def get_synonym(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'synonyms.get_synonym' } defined_params = [: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 'id' missing" unless arguments[:id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _id = arguments.delete(:id) method = Elasticsearch::API::HTTP_GET path = "_synonyms/#{Utils.__listify(_id)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_synonym_rule(arguments = {}) ⇒ Object
Retrieves a synonym rule from a synonym set
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/synonyms/get_synonym_rule.rb', line 33 def get_synonym_rule(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'synonyms.get_synonym_rule' } defined_params = %i[set_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 'set_id' missing" unless arguments[:set_id] raise ArgumentError, "Required argument 'rule_id' missing" unless arguments[:rule_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _set_id = arguments.delete(:set_id) _rule_id = arguments.delete(:rule_id) method = Elasticsearch::API::HTTP_GET path = "_synonyms/#{Utils.__listify(_set_id)}/#{Utils.__listify(_rule_id)}" params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#get_synonyms_sets(arguments = {}) ⇒ Object
Retrieves a summary of all defined synonym sets
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elasticsearch/api/actions/synonyms/get_synonyms_sets.rb', line 33 def get_synonyms_sets(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'synonyms.get_synonyms_sets' } arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil method = Elasticsearch::API::HTTP_GET path = '_synonyms' params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_synonym(arguments = {}) ⇒ Object
Creates or updates a synonyms set
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/synonyms/put_synonym.rb', line 33 def put_synonym(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'synonyms.put_synonym' } defined_params = [: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 'id' missing" unless arguments[:id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _id = arguments.delete(:id) method = Elasticsearch::API::HTTP_PUT path = "_synonyms/#{Utils.__listify(_id)}" params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |
#put_synonym_rule(arguments = {}) ⇒ Object
Creates or updates a synonym rule in a synonym set
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/synonyms/put_synonym_rule.rb', line 34 def put_synonym_rule(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'synonyms.put_synonym_rule' } defined_params = %i[set_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 'set_id' missing" unless arguments[:set_id] raise ArgumentError, "Required argument 'rule_id' missing" unless arguments[:rule_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _set_id = arguments.delete(:set_id) _rule_id = arguments.delete(:rule_id) method = Elasticsearch::API::HTTP_PUT path = "_synonyms/#{Utils.__listify(_set_id)}/#{Utils.__listify(_rule_id)}" params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |