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

Instance Method Details

#delete_synonym(arguments = {}) ⇒ Object

Deletes a synonym set 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.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    The id of the synonyms set to be deleted

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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/api/actions/synonyms/delete_synonym.rb', line 36

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 = 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 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.

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

  • :rule_id (String)

    The id of the synonym rule to be deleted

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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

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 = 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 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.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    The name of the synonyms set to be retrieved

  • :from (Integer)

    Starting offset

  • :size (Integer)

    specifies a max number of results to get

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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/api/actions/synonyms/get_synonym.rb', line 38

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 = 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 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.

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

  • :rule_id (String)

    The id of the synonym rule to retrieve

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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

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 = 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 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.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :from (Integer)

    Starting offset

  • :size (Integer)

    specifies a max number of results to get

  • :headers (Hash)

    Custom HTTP headers

See Also:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/elasticsearch/api/actions/synonyms/get_synonyms_sets.rb', line 37

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 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.

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

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    Synonyms set rules (Required)

Raises:

  • (ArgumentError)

See Also:



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/api/actions/synonyms/put_synonym.rb', line 37

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 = 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 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.

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

  • :rule_id (String)

    The id of the synonym rule to be updated or created

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    Synonym rule (Required)

Raises:

  • (ArgumentError)

See Also:



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
65
66
67
# File 'lib/elasticsearch/api/actions/synonyms/put_synonym_rule.rb', line 38

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 = 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