elasticsearch-persistence 5.0.2 → 6.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +5 -5
  2. data/.rspec +2 -0
  3. data/Gemfile +9 -0
  4. data/README.md +206 -338
  5. data/Rakefile +15 -12
  6. data/elasticsearch-persistence.gemspec +6 -7
  7. data/examples/notes/application.rb +3 -4
  8. data/lib/elasticsearch/persistence.rb +2 -110
  9. data/lib/elasticsearch/persistence/repository.rb +212 -53
  10. data/lib/elasticsearch/persistence/repository/dsl.rb +94 -0
  11. data/lib/elasticsearch/persistence/repository/find.rb +27 -10
  12. data/lib/elasticsearch/persistence/repository/response/results.rb +21 -8
  13. data/lib/elasticsearch/persistence/repository/search.rb +30 -18
  14. data/lib/elasticsearch/persistence/repository/serialize.rb +65 -7
  15. data/lib/elasticsearch/persistence/repository/store.rb +38 -44
  16. data/lib/elasticsearch/persistence/version.rb +1 -1
  17. data/spec/repository/find_spec.rb +179 -0
  18. data/spec/repository/response/results_spec.rb +128 -0
  19. data/spec/repository/search_spec.rb +181 -0
  20. data/spec/repository/serialize_spec.rb +53 -0
  21. data/spec/repository/store_spec.rb +327 -0
  22. data/spec/repository_spec.rb +723 -0
  23. data/spec/spec_helper.rb +32 -0
  24. metadata +26 -104
  25. data/examples/music/album.rb +0 -54
  26. data/examples/music/artist.rb +0 -70
  27. data/examples/music/artists/_form.html.erb +0 -8
  28. data/examples/music/artists/artists_controller.rb +0 -67
  29. data/examples/music/artists/artists_controller_test.rb +0 -53
  30. data/examples/music/artists/index.html.erb +0 -60
  31. data/examples/music/artists/show.html.erb +0 -54
  32. data/examples/music/assets/application.css +0 -257
  33. data/examples/music/assets/autocomplete.css +0 -48
  34. data/examples/music/assets/blank_artist.png +0 -0
  35. data/examples/music/assets/blank_cover.png +0 -0
  36. data/examples/music/assets/form.css +0 -113
  37. data/examples/music/index_manager.rb +0 -73
  38. data/examples/music/search/index.html.erb +0 -95
  39. data/examples/music/search/search_controller.rb +0 -41
  40. data/examples/music/search/search_controller_test.rb +0 -12
  41. data/examples/music/search/search_helper.rb +0 -15
  42. data/examples/music/suggester.rb +0 -69
  43. data/examples/music/template.rb +0 -430
  44. data/examples/music/vendor/assets/jquery-ui-1.10.4.custom.min.css +0 -7
  45. data/examples/music/vendor/assets/jquery-ui-1.10.4.custom.min.js +0 -6
  46. data/examples/music/vendor/assets/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  47. data/lib/elasticsearch/persistence/client.rb +0 -51
  48. data/lib/elasticsearch/persistence/model.rb +0 -135
  49. data/lib/elasticsearch/persistence/model/base.rb +0 -87
  50. data/lib/elasticsearch/persistence/model/errors.rb +0 -8
  51. data/lib/elasticsearch/persistence/model/find.rb +0 -180
  52. data/lib/elasticsearch/persistence/model/rails.rb +0 -47
  53. data/lib/elasticsearch/persistence/model/store.rb +0 -254
  54. data/lib/elasticsearch/persistence/model/utils.rb +0 -0
  55. data/lib/elasticsearch/persistence/repository/class.rb +0 -71
  56. data/lib/elasticsearch/persistence/repository/naming.rb +0 -115
  57. data/lib/rails/generators/elasticsearch/model/model_generator.rb +0 -21
  58. data/lib/rails/generators/elasticsearch/model/templates/model.rb.tt +0 -9
  59. data/lib/rails/generators/elasticsearch_generator.rb +0 -2
  60. data/test/integration/model/model_basic_test.rb +0 -233
  61. data/test/integration/repository/custom_class_test.rb +0 -85
  62. data/test/integration/repository/customized_class_test.rb +0 -82
  63. data/test/integration/repository/default_class_test.rb +0 -116
  64. data/test/integration/repository/virtus_model_test.rb +0 -118
  65. data/test/test_helper.rb +0 -55
  66. data/test/unit/model_base_test.rb +0 -72
  67. data/test/unit/model_find_test.rb +0 -153
  68. data/test/unit/model_gateway_test.rb +0 -101
  69. data/test/unit/model_rails_test.rb +0 -112
  70. data/test/unit/model_store_test.rb +0 -576
  71. data/test/unit/persistence_test.rb +0 -32
  72. data/test/unit/repository_class_test.rb +0 -51
  73. data/test/unit/repository_client_test.rb +0 -32
  74. data/test/unit/repository_find_test.rb +0 -388
  75. data/test/unit/repository_indexing_test.rb +0 -37
  76. data/test/unit/repository_module_test.rb +0 -146
  77. data/test/unit/repository_naming_test.rb +0 -146
  78. data/test/unit/repository_response_results_test.rb +0 -98
  79. data/test/unit/repository_search_test.rb +0 -117
  80. data/test/unit/repository_serialize_test.rb +0 -57
  81. data/test/unit/repository_store_test.rb +0 -303
@@ -0,0 +1,94 @@
1
+ module Elasticsearch
2
+ module Persistence
3
+ module Repository
4
+
5
+ # Include this module to get class-level methods for repository configuration.
6
+ #
7
+ # @since 6.0.0
8
+ module DSL
9
+
10
+ def self.included(base)
11
+ base.send(:extend, Elasticsearch::Model::Indexing::ClassMethods)
12
+ base.send(:extend, ClassMethods)
13
+ end
14
+
15
+ # These methods are necessary to define at the class-level so that the methods available
16
+ # via Elasticsearch::Model::Indexing::ClassMethods have the references they depend on.
17
+ #
18
+ # @since 6.0.0
19
+ module ClassMethods
20
+
21
+ # Get or set the class-level document type setting.
22
+ #
23
+ # @example
24
+ # MyRepository.document_type
25
+ #
26
+ # @return [ String, Symbol ] _type The repository's document type.
27
+ #
28
+ # @since 6.0.0
29
+ def document_type(_type = nil)
30
+ @document_type ||= (_type || DEFAULT_DOC_TYPE)
31
+ end
32
+
33
+ # Get or set the class-level index name setting.
34
+ #
35
+ # @example
36
+ # MyRepository.index_name
37
+ #
38
+ # @return [ String, Symbol ] _name The repository's index name.
39
+ #
40
+ # @since 6.0.0
41
+ def index_name(_name = nil)
42
+ @index_name ||= (_name || DEFAULT_INDEX_NAME)
43
+ end
44
+
45
+ # Get or set the class-level setting for the class used by the repository when deserializing.
46
+ #
47
+ # @example
48
+ # MyRepository.klass
49
+ #
50
+ # @return [ Class ] _class The repository's klass for deserializing.
51
+ #
52
+ # @since 6.0.0
53
+ def klass(_class = nil)
54
+ instance_variables.include?(:@klass) ? @klass : @klass = _class
55
+ end
56
+
57
+ # Get or set the class-level setting for the client used by the repository.
58
+ #
59
+ # @example
60
+ # MyRepository.client
61
+ #
62
+ # @return [ Class ] _client The repository's client.
63
+ #
64
+ # @since 6.0.0
65
+ def client(_client = nil)
66
+ @client ||= (_client || Elasticsearch::Client.new)
67
+ end
68
+
69
+ def create_index!(*args)
70
+ __raise_not_implemented_error(__method__)
71
+ end
72
+
73
+ def delete_index!(*args)
74
+ __raise_not_implemented_error(__method__)
75
+ end
76
+
77
+ def refresh_index!(*args)
78
+ __raise_not_implemented_error(__method__)
79
+ end
80
+
81
+ def index_exists?(*args)
82
+ __raise_not_implemented_error(__method__)
83
+ end
84
+
85
+ private
86
+
87
+ def __raise_not_implemented_error(_method_)
88
+ raise NotImplementedError, "The '#{_method_}' method is not implemented on the Repository class."
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -40,19 +40,35 @@ module Elasticsearch
40
40
  # repository.exists?(1)
41
41
  # => true
42
42
  #
43
+ # @param [ String, Integer ] id The id to search.
44
+ # @param [ Hash ] options The options.
45
+ #
43
46
  # @return [true, false]
44
47
  #
45
48
  def exists?(id, options={})
46
- type = document_type || (klass ? __get_type_from_class(klass) : '_all')
47
- client.exists( { index: index_name, type: type, id: id }.merge(options) )
49
+ request = { index: index_name, id: id }
50
+ request[:type] = document_type if document_type
51
+ client.exists(request.merge(options))
48
52
  end
49
53
 
54
+ private
55
+
56
+ # The key for accessing the document found and returned from an
57
+ # Elasticsearch _mget query.
58
+ #
59
+ DOCS = 'docs'.freeze
60
+
61
+ # The key for the boolean value indicating whether a particular id
62
+ # has been successfully found in an Elasticsearch _mget query.
63
+ #
64
+ FOUND = 'found'.freeze
65
+
50
66
  # @api private
51
67
  #
52
68
  def __find_one(id, options={})
53
- type = document_type || (klass ? __get_type_from_class(klass) : '_all')
54
- document = client.get( { index: index_name, type: type, id: id }.merge(options) )
55
-
69
+ request = { index: index_name, id: id }
70
+ request[:type] = document_type if document_type
71
+ document = client.get(request.merge(options))
56
72
  deserialize(document)
57
73
  rescue Elasticsearch::Transport::Transport::Errors::NotFound => e
58
74
  raise DocumentNotFound, e.message, caller
@@ -61,13 +77,14 @@ module Elasticsearch
61
77
  # @api private
62
78
  #
63
79
  def __find_many(ids, options={})
64
- type = document_type || (klass ? __get_type_from_class(klass) : '_all')
65
- documents = client.mget( { index: index_name, type: type, body: { ids: ids } }.merge(options) )
66
-
67
- documents['docs'].map { |document| document['found'] ? deserialize(document) : nil }
80
+ request = { index: index_name, body: { ids: ids } }
81
+ request[:type] = document_type if document_type
82
+ documents = client.mget(request.merge(options))
83
+ documents[DOCS].map do |document|
84
+ deserialize(document) if document[FOUND]
85
+ end
68
86
  end
69
87
  end
70
-
71
88
  end
72
89
  end
73
90
  end
@@ -11,6 +11,19 @@ module Elasticsearch
11
11
  include Enumerable
12
12
 
13
13
  attr_reader :repository
14
+ attr_reader :raw_response
15
+
16
+ # The key for accessing the results in an Elasticsearch query response.
17
+ #
18
+ HITS = 'hits'.freeze
19
+
20
+ # The key for accessing the total number of hits in an Elasticsearch query response.
21
+ #
22
+ TOTAL = 'total'.freeze
23
+
24
+ # The key for accessing the maximum score in an Elasticsearch query response.
25
+ #
26
+ MAX_SCORE = 'max_score'.freeze
14
27
 
15
28
  # @param repository [Elasticsearch::Persistence::Repository::Class] The repository instance
16
29
  # @param response [Hash] The full response returned from the Elasticsearch client
@@ -18,8 +31,8 @@ module Elasticsearch
18
31
  #
19
32
  def initialize(repository, response, options={})
20
33
  @repository = repository
21
- @response = Elasticsearch::Model::HashWrapper.new(response)
22
- @options = options
34
+ @raw_response = response
35
+ @options = options
23
36
  end
24
37
 
25
38
  def method_missing(method_name, *arguments, &block)
@@ -33,25 +46,25 @@ module Elasticsearch
33
46
  # The number of total hits for a query
34
47
  #
35
48
  def total
36
- response['hits']['total']
49
+ raw_response[HITS][TOTAL]
37
50
  end
38
51
 
39
52
  # The maximum score for a query
40
53
  #
41
54
  def max_score
42
- response['hits']['max_score']
55
+ raw_response[HITS][MAX_SCORE]
43
56
  end
44
57
 
45
58
  # Yields [object, hit] pairs to the block
46
59
  #
47
60
  def each_with_hit(&block)
48
- results.zip(response['hits']['hits']).each(&block)
61
+ results.zip(raw_response[HITS][HITS]).each(&block)
49
62
  end
50
63
 
51
64
  # Yields [object, hit] pairs and returns the result
52
65
  #
53
66
  def map_with_hit(&block)
54
- results.zip(response['hits']['hits']).map(&block)
67
+ results.zip(raw_response[HITS][HITS]).map(&block)
55
68
  end
56
69
 
57
70
  # Return the collection of domain objects
@@ -64,7 +77,7 @@ module Elasticsearch
64
77
  # @return [Array]
65
78
  #
66
79
  def results
67
- @results ||= response['hits']['hits'].map do |document|
80
+ @results ||= raw_response[HITS][HITS].map do |document|
68
81
  repository.deserialize(document.to_hash)
69
82
  end
70
83
  end
@@ -81,7 +94,7 @@ module Elasticsearch
81
94
  # @return [Elasticsearch::Model::HashWrapper]
82
95
  #
83
96
  def response
84
- @response
97
+ @response ||= Elasticsearch::Model::HashWrapper.new(raw_response)
85
98
  end
86
99
  end
87
100
  end
@@ -37,21 +37,24 @@ module Elasticsearch
37
37
  # # GET http://localhost:9200/notes/note/_search
38
38
  # # > {"query":{"match":{"title":"fox dog"}},"size":25}
39
39
  #
40
+ # @param [ Hash, String ] query_or_definition The query or search definition.
41
+ # @param [ Hash ] options The search options.
42
+ #
40
43
  # @return [Elasticsearch::Persistence::Repository::Response::Results]
41
44
  #
42
45
  def search(query_or_definition, options={})
43
- type = document_type || (klass ? __get_type_from_class(klass) : nil )
44
-
45
- case
46
- when query_or_definition.respond_to?(:to_hash)
47
- response = client.search( { index: index_name, type: type, body: query_or_definition.to_hash }.merge(options) )
48
- when query_or_definition.is_a?(String)
49
- response = client.search( { index: index_name, type: type, q: query_or_definition }.merge(options) )
46
+ request = { index: index_name,
47
+ type: document_type }
48
+ if query_or_definition.respond_to?(:to_hash)
49
+ request[:body] = query_or_definition.to_hash
50
+ elsif query_or_definition.is_a?(String)
51
+ request[:q] = query_or_definition
50
52
  else
51
53
  raise ArgumentError, "[!] Pass the search definition as a Hash-like object or pass the query as a String" +
52
- " -- #{query_or_definition.class} given."
54
+ " -- #{query_or_definition.class} given."
53
55
  end
54
- Response::Results.new(self, response)
56
+
57
+ Response::Results.new(self, client.search(request.merge(options)))
55
58
  end
56
59
 
57
60
  # Return the number of domain object in the index
@@ -71,25 +74,34 @@ module Elasticsearch
71
74
  # repository.search(query: { match: { title: 'fox dog' } })
72
75
  # # => 1
73
76
  #
77
+ # @param [ Hash, String ] query_or_definition The query or search definition.
78
+ # @param [ Hash ] options The search options.
79
+ #
74
80
  # @return [Integer]
75
81
  #
76
82
  def count(query_or_definition=nil, options={})
77
83
  query_or_definition ||= { query: { match_all: {} } }
78
- type = document_type || (klass ? __get_type_from_class(klass) : nil )
84
+ request = { index: index_name,
85
+ type: document_type }
79
86
 
80
- case
81
- when query_or_definition.respond_to?(:to_hash)
82
- response = client.count( { index: index_name, type: type, body: query_or_definition.to_hash }.merge(options) )
83
- when query_or_definition.is_a?(String)
84
- response = client.count( { index: index_name, type: type, q: query_or_definition }.merge(options) )
87
+ if query_or_definition.respond_to?(:to_hash)
88
+ request[:body] = query_or_definition.to_hash
89
+ elsif query_or_definition.is_a?(String)
90
+ request[:q] = query_or_definition
85
91
  else
86
- raise ArgumentError, "[!] Pass the search definition as a Hash-like object or pass the query as a String, not as [#{query_or_definition.class}]"
92
+ raise ArgumentError, "[!] Pass the search definition as a Hash-like object or pass the query as a String" +
93
+ " -- #{query_or_definition.class} given."
87
94
  end
88
95
 
89
- response['count']
96
+ client.count(request.merge(options))[COUNT]
90
97
  end
91
- end
92
98
 
99
+ private
100
+
101
+ # The key for accessing the count in a Elasticsearch query response.
102
+ #
103
+ COUNT = 'count'.freeze
104
+ end
93
105
  end
94
106
  end
95
107
  end
@@ -2,30 +2,88 @@ module Elasticsearch
2
2
  module Persistence
3
3
  module Repository
4
4
 
5
- # Provide serialization and deserialization between Ruby objects and Elasticsearch documents
5
+ # Provide serialization and deserialization between Ruby objects and Elasticsearch documents.
6
6
  #
7
7
  # Override these methods in your repository class to customize the logic.
8
8
  #
9
9
  module Serialize
10
10
 
11
- # Serialize the object for storing it in Elasticsearch
11
+ # Serialize the object for storing it in Elasticsearch.
12
12
  #
13
13
  # In the default implementation, call the `to_hash` method on the passed object.
14
14
  #
15
+ # @param [ Object ] document The Ruby object to serialize.
16
+ #
17
+ # @return [ Hash ] The serialized document.
18
+ #
15
19
  def serialize(document)
16
20
  document.to_hash
17
21
  end
18
22
 
19
- # Deserialize the document retrieved from Elasticsearch into a Ruby object
23
+ # Deserialize the document retrieved from Elasticsearch into a Ruby object.
24
+ # If no klass is set for the Repository then the raw document '_source' field will be returned.
25
+ #
26
+ # def deserialize(document)
27
+ # Note.new document[SOURCE]
28
+ # end
20
29
  #
21
- # Use the `klass` property, if defined, otherwise try to get the class from the document's `_type`.
30
+ # @param [ Hash ] document The raw document.
31
+ #
32
+ # @return [ Object ] The deserialized object.
22
33
  #
23
34
  def deserialize(document)
24
- _klass = klass || __get_klass_from_type(document['_type'])
25
- _klass.new document['_source']
35
+ klass ? klass.new(document[SOURCE]) : document[SOURCE]
26
36
  end
27
- end
28
37
 
38
+ private
39
+
40
+ # The key for document fields in an Elasticsearch query response.
41
+ #
42
+ SOURCE = '_source'.freeze
43
+
44
+ # The key for the document type in an Elasticsearch query response.
45
+ # Note that it will be removed eventually, as multiple types in a single
46
+ # index are deprecated as of Elasticsearch 6.0.
47
+ #
48
+ TYPE = '_type'.freeze
49
+
50
+ IDS = [:id, 'id', :_id, '_id'].freeze
51
+
52
+ # Get a document ID from the document (assuming Hash or Hash-like object)
53
+ #
54
+ # @example
55
+ # repository.__get_id_from_document title: 'Test', id: 'abc123'
56
+ # => "abc123"
57
+ #
58
+ # @api private
59
+ #
60
+ def __get_id_from_document(document)
61
+ document[IDS.find { |id| document[id] }]
62
+ end
63
+
64
+ # Extract a document ID from the document (assuming Hash or Hash-like object)
65
+ #
66
+ # @note Calling this method will *remove* the `id` or `_id` key from the passed object.
67
+ #
68
+ # @example
69
+ # options = { title: 'Test', id: 'abc123' }
70
+ # repository.__extract_id_from_document options
71
+ # # => "abc123"
72
+ # options
73
+ # # => { title: 'Test' }
74
+ #
75
+ # @api private
76
+ #
77
+ def __extract_id_from_document(document)
78
+ IDS.inject(nil) do |deleted, id|
79
+ if document[id]
80
+ document.delete(id)
81
+ else
82
+ deleted
83
+ end
84
+ end
85
+ end
86
+ end
29
87
  end
30
88
  end
31
89
  end
@@ -12,13 +12,19 @@ module Elasticsearch
12
12
  # repository.save(myobject)
13
13
  # => {"_index"=>"...", "_type"=>"...", "_id"=>"...", "_version"=>1, "created"=>true}
14
14
  #
15
- # @return {Hash} The response from Elasticsearch
15
+ # @param [ Object ] document The document to save into Elasticsearch.
16
+ # @param [ Hash ] options The save request options.
17
+ #
18
+ # @return [ Hash ] The response from Elasticsearch
16
19
  #
17
20
  def save(document, options={})
18
21
  serialized = serialize(document)
19
- id = __get_id_from_document(serialized)
20
- type = document_type || __get_type_from_class(klass || document.class)
21
- client.index( { index: index_name, type: type, id: id, body: serialized }.merge(options) )
22
+ id = __get_id_from_document(serialized)
23
+ request = { index: index_name,
24
+ id: id,
25
+ body: serialized }
26
+ request[:type] = document_type if document_type
27
+ client.index(request.merge(options))
22
28
  end
23
29
 
24
30
  # Update the serialized object in Elasticsearch with partial data or script
@@ -33,39 +39,27 @@ module Elasticsearch
33
39
  # repository.update 1, script: 'ctx._source.views += 1'
34
40
  # # => {"_index"=>"...", "_type"=>"...", "_id"=>"1", "_version"=>3}
35
41
  #
36
- # @return {Hash} The response from Elasticsearch
42
+ # @param [ Object ] document_or_id The document to update or the id of the document to update.
43
+ # @param [ Hash ] options The update request options.
37
44
  #
38
- def update(document, options={})
39
- case
40
- when document.is_a?(String) || document.is_a?(Integer)
41
- id = document
42
- when document.respond_to?(:to_hash)
43
- serialized = document.to_hash
44
- id = __extract_id_from_document(serialized)
45
- else
46
- raise ArgumentError, "Expected a document ID or a Hash-like object, #{document.class} given"
47
- end
48
-
49
- type = options.delete(:type) || \
50
- (defined?(serialized) && serialized && serialized.delete(:type)) || \
51
- document_type || \
52
- __get_type_from_class(klass)
53
-
54
- if defined?(serialized) && serialized
55
- body = if serialized[:script]
56
- serialized.select { |k, v| [:script, :params, :upsert].include? k }
57
- else
58
- { doc: serialized }
59
- end
45
+ # @return [ Hash ] The response from Elasticsearch
46
+ #
47
+ def update(document_or_id, options = {})
48
+ if document_or_id.is_a?(String) || document_or_id.is_a?(Integer)
49
+ id = document_or_id
50
+ body = options
51
+ type = document_type
60
52
  else
61
- body = {}
62
- body.update( doc: options.delete(:doc)) if options[:doc]
63
- body.update( script: options.delete(:script)) if options[:script]
64
- body.update( params: options.delete(:params)) if options[:params]
65
- body.update( upsert: options.delete(:upsert)) if options[:upsert]
53
+ document = serialize(document_or_id)
54
+ id = __extract_id_from_document(document)
55
+ if options[:script]
56
+ body = options
57
+ else
58
+ body = { doc: document }.merge(options)
59
+ end
60
+ type = document.delete(:type) || document_type
66
61
  end
67
-
68
- client.update( { index: index_name, type: type, id: id, body: body }.merge(options) )
62
+ client.update(index: index_name, id: id, type: type, body: body)
69
63
  end
70
64
 
71
65
  # Remove the serialized object or document with specified ID from Elasticsearch
@@ -75,21 +69,21 @@ module Elasticsearch
75
69
  # repository.delete(1)
76
70
  # # => {"_index"=>"...", "_type"=>"...", "_id"=>"1", "_version"=>4}
77
71
  #
78
- # @return {Hash} The response from Elasticsearch
72
+ # @param [ Object ] document_or_id The document to delete or the id of the document to delete.
73
+ # @param [ Hash ] options The delete request options.
79
74
  #
80
- def delete(document, options={})
81
- if document.is_a?(String) || document.is_a?(Integer)
82
- id = document
83
- type = document_type || __get_type_from_class(klass)
75
+ # @return [ Hash ] The response from Elasticsearch
76
+ #
77
+ def delete(document_or_id, options = {})
78
+ if document_or_id.is_a?(String) || document_or_id.is_a?(Integer)
79
+ id = document_or_id
84
80
  else
85
- serialized = serialize(document)
86
- id = __get_id_from_document(serialized)
87
- type = document_type || __get_type_from_class(klass || document.class)
81
+ serialized = serialize(document_or_id)
82
+ id = __get_id_from_document(serialized)
88
83
  end
89
- client.delete( { index: index_name, type: type, id: id }.merge(options) )
84
+ client.delete({ index: index_name, type: document_type, id: id }.merge(options))
90
85
  end
91
86
  end
92
-
93
87
  end
94
88
  end
95
89
  end