Method: Elasticsearch::API::Fleet::Actions#search

Defined in:
lib/elasticsearch/api/actions/fleet/search.rb

#search(arguments = {}) ⇒ Object

Search API where the search will only be executed after specified checkpoints are available due to a refresh. This API is designed for internal use by the fleet server project. 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):

  • :index (String)

    The index name to search.

  • :wait_for_checkpoints (List)

    Comma separated list of checkpoints, one per shard

  • :wait_for_checkpoints_timeout (Time)

    Explicit wait_for_checkpoints timeout

  • :allow_partial_search_results (Boolean)

    Indicate if an error should be returned if there is a partial search failure or timeout

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The search definition using the Query DSL

Raises:

  • (ArgumentError)

See Also:

  • [TODO]

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
# File 'lib/elasticsearch/api/actions/fleet/search.rb', line 40

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

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

  body = arguments.delete(:body)

  arguments[:index] = UNDERSCORE_ALL if !arguments[:index] && arguments[:type]

  _index = arguments.delete(:index)

  method = if body
             Elasticsearch::API::HTTP_POST
           else
             Elasticsearch::API::HTTP_GET
           end

  path   = "#{Utils.__listify(_index)}/_fleet/_fleet_search"
  params = Utils.process_params(arguments)

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