Module: Elasticsearch::API::Synonyms::Actions

Included in:
SynonymsClient
Defined in:
lib/elasticsearch/api/namespace/synonyms.rb,
lib/elasticsearch/api/actions/synonyms/get.rb,
lib/elasticsearch/api/actions/synonyms/put.rb,
lib/elasticsearch/api/actions/synonyms/delete.rb

Instance Method Summary collapse

Instance Method Details

#delete(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):

  • :synonyms_set (String)

    The name 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
# File 'lib/elasticsearch/api/actions/synonyms/delete.rb', line 36

def delete(arguments = {})
  raise ArgumentError, "Required argument 'synonyms_set' missing" unless arguments[:synonyms_set]

  arguments = arguments.clone
  headers = arguments.delete(:headers) || {}

  body = nil

  _synonyms_set = arguments.delete(:synonyms_set)

  method = Elasticsearch::API::HTTP_DELETE
  path   = "_synonyms/#{Utils.__listify(_synonyms_set)}"
  params = {}

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

#get(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):

  • :synonyms_set (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
# File 'lib/elasticsearch/api/actions/synonyms/get.rb', line 38

def get(arguments = {})
  raise ArgumentError, "Required argument 'synonyms_set' missing" unless arguments[:synonyms_set]

  arguments = arguments.clone
  headers = arguments.delete(:headers) || {}

  body = nil

  _synonyms_set = arguments.delete(:synonyms_set)

  method = Elasticsearch::API::HTTP_GET
  path   = "_synonyms/#{Utils.__listify(_synonyms_set)}"
  params = Utils.process_params(arguments)

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

#put(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):

  • :synonyms_set (String)

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

def put(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
  raise ArgumentError, "Required argument 'synonyms_set' missing" unless arguments[:synonyms_set]

  arguments = arguments.clone
  headers = arguments.delete(:headers) || {}

  body = arguments.delete(:body)

  _synonyms_set = arguments.delete(:synonyms_set)

  method = Elasticsearch::API::HTTP_PUT
  path   = "_synonyms/#{Utils.__listify(_synonyms_set)}"
  params = {}

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