Sha256: ddfdbfd12698ce114dc61ea19590194b9fbfe467766a57ddb8bd848765c9fc78

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 Bytes

Contents

module Elasticsearch
  module API
    module Actions

      # Store a template for the search definition in Elasticsearch,
      # to be later used with the `search_template` method
      #
      # @option arguments [String] :id Template ID (*Required*)
      # @option arguments [Hash] :body The document (*Required*)
      #
      # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html
      #
      def put_template(arguments={})
        Utils.__report_unsupported_method(__method__)

        raise ArgumentError, "Required argument 'id' missing"   unless arguments[:id]
        raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
        method = HTTP_PUT
        path   = "_search/template/#{arguments[:id]}"
        params = {}
        body   = arguments[:body]

        perform_request(method, path, params, body).body
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
elasticsearch-api-1.1.3 lib/elasticsearch/api/actions/put_template.rb
elasticsearch-api-1.1.2 lib/elasticsearch/api/actions/put_template.rb
elasticsearch-api-1.1.1 lib/elasticsearch/api/actions/put_template.rb