Sha256: f60a718ed70841ab76a07b4e9587b7e06ad0126dfba6479c0ab9381ba7f6f90b

Contents?: true

Size: 866 Bytes

Versions: 2

Compression:

Stored size: 866 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={})
        raise ArgumentError, "Required argument 'id' missing"   unless arguments[:id]
        raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
        method = 'PUT'
        path   = "_search/template/#{arguments[:id]}"
        params = {}
        body   = arguments[:body]

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
elasticsearch-api-1.0.6 lib/elasticsearch/api/actions/put_template.rb
elasticsearch-api-1.0.5 lib/elasticsearch/api/actions/put_template.rb