elasticsearch-api/lib/elasticsearch/api/actions/msearch_template.rb
# Allows to execute several search template operations in one request.
#
# @option arguments [List] :index A comma-separated list of index names to use as default
# @option arguments [String] :search_type Search operation type (options: query_then_fetch, dfs_query_then_fetch)
# @option arguments [Boolean] :typed_keys Specify whether aggregation and suggester names should be prefixed by their respective types in the response
# @option arguments [Number] :max_concurrent_searches Controls the maximum number of concurrent searches the multi search api will execute
# @option arguments [Boolean] :rest_total_hits_as_int Indicates whether hits.total should be rendered as an integer or an object in the rest search response
# @option arguments [Boolean] :ccs_minimize_roundtrips Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
# @option arguments [Hash] :headers Custom HTTP headers
# @option arguments [Hash] :body The request definitions (metadata-search request definition pairs), separated by newlines (*Required*)
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html
#
Allows to execute several search template operations in one request.
Allows to execute several search template operations in one request .
def msearch_template(arguments = {})
        raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
        headers = arguments.delete(:headers) || {}
        body = arguments.delete(:body)
        arguments = arguments.clone
        _index = arguments.delete(:index)
        method = Elasticsearch::API::HTTP_POST
        path   = if _index
                   "#{Utils.__listify(_index)}/_msearch/template"
                 else
                   "_msearch/template"
                 end
        params = Utils.process_params(arguments)
        case
        when body.is_a?(Array)
          payload = body.map { |d| d.is_a?(String) ? d : Elasticsearch::API.serializer.dump(d) }
          payload << "" unless payload.empty?
          payload = payload.join("
")
        else
          payload = body
        end
        headers.merge!("Content-Type" => "application/x-ndjson")
        perform_request(method, path, params, payload, headers).body
      end
def msearch_template ( arguments = { } ) raise ArgumentError , "Required argument 'body' missing" unless arguments [ :body ] headers = arguments . delete ( :headers ) || { } body = arguments . delete ( :body ) arguments = arguments . clone _index = arguments . delete ( :index ) method = Elasticsearch :: API :: HTTP_POST path = if _index "#{Utils.__listify(_index)}/_msearch/template" else "_msearch/template" end params = Utils . process_params ( arguments ) case when body . is_a? ( Array ) payload = body . map { | d | d . is_a? ( String ) ? d : Elasticsearch :: API . serializer . dump ( d ) } payload << "" unless payload . empty? payload = payload . join ( "
" ) else payload = body end headers . merge! ( "Content-Type" => "application/x-ndjson" ) perform_request ( method , path , params , payload , headers ) . body end
Allows to execute several search template operations in one request.
Allows to execute several search template operations in one request .
arguments
:body The request definitions (metadata-search request definition pairs), separated by newlines (*Required*)
: body The request definitions ( metadata - search request definition pairs ) separated by newlines ( * Required * )
see
None