Module: ElasticsearchServerless::API::Synonyms::Actions

Defined in:
lib/elasticsearch-serverless/api/synonyms/get_synonym.rb,
lib/elasticsearch-serverless/api/synonyms/put_synonym.rb,
lib/elasticsearch-serverless/api/synonyms/delete_synonym.rb,
lib/elasticsearch-serverless/api/synonyms/get_synonym_rule.rb,
lib/elasticsearch-serverless/api/synonyms/put_synonym_rule.rb,
lib/elasticsearch-serverless/api/synonyms/get_synonyms_sets.rb,
lib/elasticsearch-serverless/api/synonyms/delete_synonym_rule.rb

Instance Method Summary collapse

Instance Method Details

#delete_synonym(arguments = {}) ⇒ Object

Deletes a synonym set

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    The id of the synonyms set to be deleted (Required)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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
# File 'lib/elasticsearch-serverless/api/synonyms/delete_synonym.rb', line 32

def delete_synonym(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "synonyms.delete_synonym" }

  defined_params = [:id].inject({}) do |set_variables, variable|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
    set_variables
  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 = ElasticsearchServerless::API::HTTP_DELETE
  path   = "_synonyms/#{Utils.listify(_id)}"
  params = {}

  ElasticsearchServerless::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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :set_id (String)

    The id of the synonym set to be updated (Required)

  • :rule_id (String)

    The id of the synonym rule to be deleted (Required)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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
# File 'lib/elasticsearch-serverless/api/synonyms/delete_synonym_rule.rb', line 33

def delete_synonym_rule(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "synonyms.delete_synonym_rule" }

  defined_params = [:set_id, :rule_id].inject({}) do |set_variables, variable|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
    set_variables
  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 = ElasticsearchServerless::API::HTTP_DELETE
  path   = "_synonyms/#{Utils.listify(_set_id)}/#{Utils.listify(_rule_id)}"
  params = {}

  ElasticsearchServerless::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end

#get_synonym(arguments = {}) ⇒ Object

Retrieves a synonym set

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    “The id of the synonyms set to be retrieved (Required)

  • :from (Integer)

    Starting offset for query rules to be retrieved Server default: 0.

  • :size (Integer)

    specifies a max number of query rules to retrieve Server default: 10.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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
# File 'lib/elasticsearch-serverless/api/synonyms/get_synonym.rb', line 34

def get_synonym(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "synonyms.get_synonym" }

  defined_params = [:id].inject({}) do |set_variables, variable|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
    set_variables
  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 = ElasticsearchServerless::API::HTTP_GET
  path   = "_synonyms/#{Utils.listify(_id)}"
  params = Utils.process_params(arguments)

  ElasticsearchServerless::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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :set_id (String)

    The id of the synonym set to retrieve the synonym rule from (Required)

  • :rule_id (String)

    The id of the synonym rule to retrieve (Required)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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
# File 'lib/elasticsearch-serverless/api/synonyms/get_synonym_rule.rb', line 33

def get_synonym_rule(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "synonyms.get_synonym_rule" }

  defined_params = [:set_id, :rule_id].inject({}) do |set_variables, variable|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
    set_variables
  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 = ElasticsearchServerless::API::HTTP_GET
  path   = "_synonyms/#{Utils.listify(_set_id)}/#{Utils.listify(_rule_id)}"
  params = {}

  ElasticsearchServerless::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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :from (Integer)

    Starting offset Server default: 0.

  • :size (Integer)

    specifies a max number of results to get Server default: 10.

  • :headers (Hash)

    Custom HTTP headers

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/elasticsearch-serverless/api/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 = ElasticsearchServerless::API::HTTP_GET
  path   = "_synonyms"
  params = Utils.process_params(arguments)

  ElasticsearchServerless::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end

#put_synonym(arguments = {}) ⇒ Object

Creates or updates a synonym set.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    The id of the synonyms set to be created or updated (Required)

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



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
# File 'lib/elasticsearch-serverless/api/synonyms/put_synonym.rb', line 33

def put_synonym(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "synonyms.put_synonym" }

  defined_params = [:id].inject({}) do |set_variables, variable|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
    set_variables
  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 = ElasticsearchServerless::API::HTTP_PUT
  path   = "_synonyms/#{Utils.listify(_id)}"
  params = {}

  ElasticsearchServerless::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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :set_id (String)

    The id of the synonym set to be updated with the synonym rule (Required)

  • :rule_id (String)

    The id of the synonym rule to be updated or created (Required)

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



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
# File 'lib/elasticsearch-serverless/api/synonyms/put_synonym_rule.rb', line 34

def put_synonym_rule(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "synonyms.put_synonym_rule" }

  defined_params = [:set_id, :rule_id].inject({}) do |set_variables, variable|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
    set_variables
  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 = ElasticsearchServerless::API::HTTP_PUT
  path   = "_synonyms/#{Utils.listify(_set_id)}/#{Utils.listify(_rule_id)}"
  params = {}

  ElasticsearchServerless::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end