Skip to content

Commit 4b3046f

Browse files
lulalalaestolfo
authored andcommitted
Doc: fix return example as @example only allows one line (elastic#889)
Add return example
1 parent 460475d commit 4b3046f

File tree

1 file changed

+33
-12
lines changed

1 file changed

+33
-12
lines changed

Diff for: elasticsearch-model/lib/elasticsearch/model/importing.rb

+33-12
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,29 @@ module ClassMethods
5353
#
5454
# @yield [Hash] Gives the Hash with the Elasticsearch response to the block
5555
#
56-
# @return [Fixnum] Number of errors encountered during importing
56+
# @return [Fixnum] default, number of errors encountered during importing
57+
# @return [Array<Hash>] if +return+ option is specified to be +"errors"+,
58+
# contains only those failed items in the response +items+ key, e.g.:
59+
#
60+
# [
61+
# {
62+
# "index" => {
63+
# "error" => 'FAILED',
64+
# "_index" => "test",
65+
# "_type" => "_doc",
66+
# "_id" => '1',
67+
# "_version" => 1,
68+
# "result" => "foo",
69+
# "_shards" => {
70+
# "total" => 1,
71+
# "successful" => 0,
72+
# "failed" => 1
73+
# },
74+
# "status" => 400
75+
# }
76+
# }
77+
# ]
78+
#
5779
#
5880
# @example Import all records into the index
5981
#
@@ -99,20 +121,19 @@ module ClassMethods
99121
#
100122
# @example Update the batch before yielding it
101123
#
102-
# class Article
103-
# # ...
104-
# def self.enrich(batch)
105-
# batch.each do |item|
106-
# item.metadata = MyAPI.get_metadata(item.id)
107-
# end
108-
# batch
109-
# end
110-
# end
124+
# class Article
125+
# # ...
126+
# def self.enrich(batch)
127+
# batch.each do |item|
128+
# item.metadata = MyAPI.get_metadata(item.id)
129+
# end
130+
# batch
131+
# end
132+
# end
111133
#
112134
# Article.import preprocess: :enrich
113135
#
114-
# @example Return an array of error elements instead of the number of errors, eg.
115-
# to try importing these records again
136+
# @example Return an array of error elements instead of the number of errors, e.g. to try importing these records again
116137
#
117138
# Article.import return: 'errors'
118139
#

0 commit comments

Comments
 (0)