Module: Elasticsearch::API::QueryRuleset::Actions

Included in:
QueryRulesetClient
Defined in:
lib/elasticsearch/api/namespace/query_ruleset.rb,
lib/elasticsearch/api/actions/query_ruleset/get.rb,
lib/elasticsearch/api/actions/query_ruleset/put.rb,
lib/elasticsearch/api/actions/query_ruleset/list.rb,
lib/elasticsearch/api/actions/query_ruleset/delete.rb

Instance Method Summary collapse

Instance Method Details

#delete(arguments = {}) ⇒ Object

Deletes a query ruleset. 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):

  • :ruleset_id (String)

    The unique identifier of the query ruleset to delete

  • :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
# File 'lib/elasticsearch/api/actions/query_ruleset/delete.rb', line 36

def delete(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'query_ruleset.delete' }

  defined_params = [:ruleset_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 'ruleset_id' missing" unless arguments[:ruleset_id]

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

  body = nil

  _ruleset_id = arguments.delete(:ruleset_id)

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

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

#get(arguments = {}) ⇒ Object

Returns the details about a query ruleset. 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):

  • :ruleset_id (String)

    The unique identifier of the query ruleset

  • :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
# File 'lib/elasticsearch/api/actions/query_ruleset/get.rb', line 36

def get(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'query_ruleset.get' }

  defined_params = [:ruleset_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 'ruleset_id' missing" unless arguments[:ruleset_id]

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

  body = nil

  _ruleset_id = arguments.delete(:ruleset_id)

  method = Elasticsearch::API::HTTP_GET
  path   = "_query_rules/#{Utils.__listify(_ruleset_id)}"
  params = {}

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

#list(arguments = {}) ⇒ Object

Lists query rulesets. 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 (default: 0)

  • :size (Integer)

    specifies a max number of results to get (default: 100)

  • :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/query_ruleset/list.rb', line 37

def list(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'query_ruleset.list' }

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

  body   = nil

  method = Elasticsearch::API::HTTP_GET
  path   = '_query_rules'
  params = Utils.process_params(arguments)

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

#put(arguments = {}) ⇒ Object

Creates or updates a query ruleset. 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):

  • :ruleset_id (String)

    The unique identifier of the ruleset to be created or updated.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The query ruleset configuration, including ‘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
# File 'lib/elasticsearch/api/actions/query_ruleset/put.rb', line 37

def put(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'query_ruleset.put' }

  defined_params = [:ruleset_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 'ruleset_id' missing" unless arguments[:ruleset_id]

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

  body = arguments.delete(:body)

  _ruleset_id = arguments.delete(:ruleset_id)

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

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