Method: Elasticsearch::API::Synonyms::Actions#put_synonym_rule
- Defined in:
- lib/elasticsearch/api/actions/synonyms/put_synonym_rule.rb
#put_synonym_rule(arguments = {}) ⇒ Object
Create or update a synonym rule. Create or update a synonym rule in a synonym set. If any of the synonym rules included is invalid, the API returns an error. When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/elasticsearch/api/actions/synonyms/put_synonym_rule.rb', line 50 def put_synonym_rule(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'synonyms.put_synonym_rule' } defined_params = [: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 = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |