Module: Elasticsearch::XPack::API::AsyncSearch::Actions

Included in:
AsyncSearchClient
Defined in:
lib/elasticsearch/xpack/api/namespace/async_search.rb,
lib/elasticsearch/xpack/api/actions/async_search/get.rb,
lib/elasticsearch/xpack/api/actions/async_search/delete.rb,
lib/elasticsearch/xpack/api/actions/async_search/status.rb,
lib/elasticsearch/xpack/api/actions/async_search/submit.rb,
lib/elasticsearch/xpack/api/actions/async_search/params_registry.rb

Defined Under Namespace

Modules: ParamsRegistry

Instance Method Summary collapse

Instance Method Details

#delete(arguments = {}) ⇒ Object

Deletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    The async search ID

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/elasticsearch/xpack/api/actions/async_search/delete.rb', line 30

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

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

  arguments = arguments.clone

  _id = arguments.delete(:id)

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

  body = nil
  perform_request(method, path, params, body, headers).body
end

#get(arguments = {}) ⇒ Object

Retrieves the results of a previously submitted async search request given its ID.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    The async search ID

  • :wait_for_completion_timeout (Time)

    Specify the time that the request should block waiting for the final response

  • :keep_alive (Time)

    Specify the time interval in which the results (partial or final) for this search will be available

  • :typed_keys (Boolean)

    Specify whether aggregation and suggester names should be prefixed by their respective types in the response

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/elasticsearch/xpack/api/actions/async_search/get.rb', line 33

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

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

  arguments = arguments.clone

  _id = arguments.delete(:id)

  method = Elasticsearch::API::HTTP_GET
  path   = "_async_search/#{Elasticsearch::API::Utils.__listify(_id)}"
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end

#status(arguments = {}) ⇒ Object

Retrieves the status of a previously submitted async search request given its ID.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    The async search ID

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/elasticsearch/xpack/api/actions/async_search/status.rb', line 30

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

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

  arguments = arguments.clone

  _id = arguments.delete(:id)

  method = Elasticsearch::API::HTTP_GET
  path   = "_async_search/status/#{Elasticsearch::API::Utils.__listify(_id)}"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
end

#submit(arguments = {}) ⇒ Object

Executes a search request asynchronously.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names to search; use β€˜_all` or empty string to perform the operation on all indices

  • :wait_for_completion_timeout (Time)

    Specify the time that the request should block waiting for the final response

  • :keep_on_completion (Boolean)

    Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false)

  • :keep_alive (Time)

    Update the time interval in which the results (partial or final) for this search will be available

  • :batched_reduce_size (Number)

    The number of shard results that should be reduced at once on the coordinating node. This value should be used as the granularity at which progress results will be made available.

  • :request_cache (Boolean)

    Specify if request cache should be used for this request or not, defaults to true

  • :analyzer (String)

    The analyzer to use for the query string

  • :analyze_wildcard (Boolean)

    Specify whether wildcard and prefix queries should be analyzed (default: false)

  • :default_operator (String)

    The default operator for query string query (AND or OR) (options: AND, OR)

  • :df (String)

    The field to use as default where no field prefix is given in the query string

  • :explain (Boolean)

    Specify whether to return detailed information about score computation as part of a hit

  • :stored_fields (List)

    A comma-separated list of stored fields to return as part of a hit

  • :docvalue_fields (List)

    A comma-separated list of fields to return as the docvalue representation of a field for each hit

  • :from (Number)

    Starting offset (default: 0)

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :ignore_throttled (Boolean)

    Whether specified concrete, expanded or aliased indices should be ignored when throttled

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes β€˜_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :lenient (Boolean)

    Specify whether format-based query failures (such as providing text to a numeric field) should be ignored

  • :preference (String)

    Specify the node or shard the operation should be performed on (default: random)

  • :q (String)

    Query in the Lucene query string syntax

  • :routing (List)

    A comma-separated list of specific routing values

  • :search_type (String)

    Search operation type (options: query_then_fetch, dfs_query_then_fetch)

  • :size (Number)

    Number of hits to return (default: 10)

  • :sort (List)

    A comma-separated list of <field>:<direction> pairs

  • :_source (List)

    True or false to return the _source field or not, or a list of fields to return

  • :_source_excludes (List)

    A list of fields to exclude from the returned _source field

  • :_source_includes (List)

    A list of fields to extract and return from the _source field

  • :terminate_after (Number)

    The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.

  • :stats (List)

    Specific β€˜tag’ of the request for logging and statistical purposes

  • :suggest_field (String)

    Specify which field to use for suggestions

  • :suggest_mode (String)

    Specify suggest mode (options: missing, popular, always)

  • :suggest_size (Number)

    How many suggestions to return in response

  • :suggest_text (String)

    The source text for which the suggestions should be returned

  • :timeout (Time)

    Explicit operation timeout

  • :track_scores (Boolean)

    Whether to calculate and return scores even if they are not used for sorting

  • :track_total_hits (Boolean)

    Indicate if the number of documents that match the query should be tracked

  • :allow_partial_search_results (Boolean)

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

  • :typed_keys (Boolean)

    Specify whether aggregation and suggester names should be prefixed by their respective types in the response

  • :version (Boolean)

    Specify whether to return document version as part of a hit

  • :seq_no_primary_term (Boolean)

    Specify whether to return sequence number and primary term of the last modification of each hit

  • :max_concurrent_shard_requests (Number)

    The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The search definition using the Query DSL

See Also:



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/elasticsearch/xpack/api/actions/async_search/submit.rb', line 72

def submit(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_POST
  path   = if _index
             "#{Elasticsearch::API::Utils.__listify(_index)}/_async_search"
           else
             "_async_search"
           end
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end