module Elasticsearch::API::Synonyms::Actions
Public Instance Methods
Source
# File lib/elasticsearch/api/actions/synonyms/delete_synonym.rb, line 44 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 a synonym set. You can only delete a synonyms set that is not in use by any index analyzer. Synonyms
sets can be used in synonym graph token filters and synonym token filters. These synonym filters can be used as part of search analyzers. Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. To prevent that, synonyms sets that are used in analyzers can’t be deleted. A delete request in this case will return a 400 response code. To remove a synonyms set, you must first remove all indices that contain analyzers using it. You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API
in order to copy over the index data. Once finished, you can delete the index. When the synonyms set is not used in analyzers, you will be able to delete it.
@option arguments [String] :id The synonyms set identifier to delete. (Required) @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-synonyms-delete-synonym
Source
# File lib/elasticsearch/api/actions/synonyms/delete_synonym_rule.rb, line 34 def delete_synonym_rule(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'synonyms.delete_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 '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
Delete a synonym rule. Delete a synonym rule from a synonym set.
@option arguments [String] :set_id The ID of the synonym set to update. (Required) @option arguments [String] :rule_id The ID of the synonym rule to delete. (Required) @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-synonyms-delete-synonym-rule
Source
# 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 a synonym set.
@option arguments [String] :id The synonyms set identifier to retrieve. (Required) @option arguments [Integer] :from The starting offset for query rules to retrieve. Server default: 0. @option arguments [Integer] :size The max number of query rules to retrieve. Server default: 10. @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-synonyms-get-synonym
Source
# File lib/elasticsearch/api/actions/synonyms/get_synonym_rule.rb, line 34 def get_synonym_rule(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'synonyms.get_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 '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 a synonym rule. Get a synonym rule from a synonym set.
@option arguments [String] :set_id The ID of the synonym set to retrieve the synonym rule from. (Required) @option arguments [String] :rule_id The ID of the synonym rule to retrieve. (Required) @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-synonyms-get-synonym-rule
Source
# File lib/elasticsearch/api/actions/synonyms/get_synonyms_sets.rb, line 34 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
Get all synonym sets. Get a summary of all defined synonym sets.
@option arguments [Integer] :from The starting offset for synonyms sets to retrieve. Server default: 0. @option arguments [Integer] :size The maximum number of synonyms sets to retrieve. Server default: 10. @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-synonyms-get-synonym
Source
# File lib/elasticsearch/api/actions/synonyms/put_synonym.rb, line 37 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
Create or update a synonym set. Synonyms
sets are limited to a maximum of 10,000 synonym rules per set. If you need to manage more synonym rules, you can create multiple synonym sets. When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. This is equivalent to invoking the reload search analyzers API
for all indices that use the synonyms set.
@option arguments [String] :id The ID of the synonyms set to be created or updated. (Required) @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body request body
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-synonyms-put-synonym
Source
# File lib/elasticsearch/api/actions/synonyms/put_synonym_rule.rb, line 37 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 = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
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.
@option arguments [String] :set_id The ID of the synonym set. (Required) @option arguments [String] :rule_id The ID of the synonym rule to be updated or created. (Required) @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body request body
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-synonyms-put-synonym-rule