Module: Elasticsearch::API::SynonymRule::Actions

Included in:
SynonymRuleClient
Defined in:
lib/elasticsearch/api/namespace/synonym_rule.rb,
lib/elasticsearch/api/actions/synonym_rule/put.rb

Instance Method Summary collapse

Instance Method Details

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

  • :synonyms_set (String)

    The id of the synonym set to be updated with the synonym rule

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

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

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

  body = arguments.delete(:body)

  _synonyms_set = arguments.delete(:synonyms_set)

  _synonym_rule = arguments.delete(:synonym_rule)

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

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