@@ -90,11 +90,11 @@ Index several documents in one request:
9090```ruby
9191body = [
9292 { index: { _index: 'books', _id: '42' } },
93- { name: "The Hitchhiker's Guide to the Galaxy", author: 'Douglas Adams', release_date: '1979-10-12', page_count: 180},
93+ { name: "The Hitchhiker's Guide to the Galaxy", author: 'Douglas Adams', release_date: '1979-10-12', page_count: 180 },
9494 { index: { _index: 'books', _id: '43' } },
9595 { name: 'Snow Crash', author: 'Neal Stephenson', release_date: '1992-06-01', page_count: 470 },
9696 { index: { _index: 'books', _id: '44' } },
97- { name: 'Starship Troopers', author: 'Robert A. Heinlein', release_date: '1959-12-01', page_count: 335}
97+ { name: 'Starship Troopers', author: 'Robert A. Heinlein', release_date: '1959-12-01', page_count: 335 }
9898]
9999client.bulk(body: body)
100100```
@@ -134,30 +134,30 @@ First, bulk index it:
134134[source,ruby]
135135----
136136body = [
137- { index: { _index: 'books', data: {name: " Leviathan Wakes", " author": " James S.A. Corey", " release_date": " 2011-06-02", " page_count" : 561} } },
138- { index: { _index: 'books', data: {name: " Hyperion", " author": " Dan Simmons", " release_date": " 1989-05-26", " page_count" : 482} } },
139- { index: { _index: 'books', data: {name: " Dune", " author": " Frank Herbert", " release_date": " 1965-06-01", " page_count" : 604} } },
140- { index: { _index: 'books', data: {name: " Dune Messiah", " author": " Frank Herbert", " release_date": " 1969-10-15", " page_count" : 331} } },
141- { index: { _index: 'books', data: {name: " Children of Dune", " author": " Frank Herbert", " release_date": " 1976-04-21", " page_count" : 408} } },
142- { index: { _index: 'books', data: {name: " God Emperor of Dune", " author": " Frank Herbert", " release_date": " 1981-05-28", " page_count" : 454} } },
143- { index: { _index: 'books', data: {name: " Consider Phlebas", " author": " Iain M. Banks", " release_date": " 1987-04-23", " page_count" : 471} } },
144- { index: { _index: 'books', data: {name: " Pandora's Star", " author": " Peter F. Hamilton", " release_date": " 2004-03-02", " page_count" : 768} } },
145- { index: { _index: 'books', data: {name: " Revelation Space", " author": " Alastair Reynolds", " release_date": " 2000-03-15", " page_count" : 585} } },
146- { index: { _index: 'books', data: {name: " A Fire Upon the Deep", " author": " Vernor Vinge", " release_date": " 1992-06-01", " page_count" : 613} } },
147- { index: { _index: 'books', data: {name: " Ender's Game", " author": " Orson Scott Card", " release_date": " 1985-06-01", " page_count" : 324} } },
148- { index: { _index: 'books', data: {name: " 1984", " author": " George Orwell", " release_date": " 1985-06-01", " page_count" : 328} } },
149- { index: { _index: 'books', data: {name: " Fahrenheit 451", " author": " Ray Bradbury", " release_date": " 1953-10-15", " page_count" : 227} } },
150- { index: { _index: 'books', data: {name: " Brave New World", " author": " Aldous Huxley", " release_date": " 1932-06-01", " page_count" : 268} } },
151- { index: { _index: 'books', data: {name: " Foundation", " author": " Isaac Asimov", " release_date": " 1951-06-01", " page_count" : 224} } },
152- { index: { _index: 'books', data: {name: " The Giver", " author": " Lois Lowry", " release_date": " 1993-04-26", " page_count" : 208} } },
153- { index: { _index: 'books', data: {name: " Slaughterhouse-Five", " author": " Kurt Vonnegut", " release_date": " 1969-06-01", " page_count" : 275} } },
154- { index: { _index: 'books', data: {name: " The Hitchhiker's Guide to the Galaxy", " author": " Douglas Adams", " release_date": " 1979-10-12", " page_count" : 180} } },
155- { index: { _index: 'books', data: {name: " Snow Crash", " author": " Neal Stephenson", " release_date": " 1992-06-01", " page_count" : 470} } },
156- { index: { _index: 'books', data: {name: " Neuromancer", " author": " William Gibson", " release_date": " 1984-07-01", " page_count" : 271} } },
157- { index: { _index: 'books', data: {name: " The Handmaid's Tale", " author": " Margaret Atwood", " release_date": " 1985-06-01", " page_count" : 311} } },
158- { index: { _index: 'books', data: {name: " Starship Troopers", " author": " Robert A. Heinlein", " release_date": " 1959-12-01", " page_count" : 335} } },
159- { index: { _index: 'books', data: {name: " The Left Hand of Darkness", " author": " Ursula K. Le Guin", " release_date": " 1969-06-01", " page_count" : 304} } },
160- { index: { _index: 'books', data: {name: " The Moon is a Harsh Mistress", " author": " Robert A. Heinlein", " release_date": " 1966-04-01", " page_count" : 288 } } }
137+ { index: { _index: 'books', data: { name: ' Leviathan Wakes', author: ' James S.A. Corey', release_date: ' 2011-06-02', page_count: 561 } } },
138+ { index: { _index: 'books', data: { name: ' Hyperion', author: ' Dan Simmons', release_date: ' 1989-05-26', page_count: 482 } } },
139+ { index: { _index: 'books', data: { name: ' Dune', author: ' Frank Herbert', release_date: ' 1965-06-01', page_count: 604 } } },
140+ { index: { _index: 'books', data: { name: ' Dune Messiah', author: ' Frank Herbert', release_date: ' 1969-10-15', page_count: 331 } } },
141+ { index: { _index: 'books', data: { name: ' Children of Dune', author: ' Frank Herbert', release_date: ' 1976-04-21', page_count: 408 } } },
142+ { index: { _index: 'books', data: { name: ' God Emperor of Dune', author: ' Frank Herbert', release_date: ' 1981-05-28', page_count: 454 } } },
143+ { index: { _index: 'books', data: { name: ' Consider Phlebas', author: ' Iain M. Banks', release_date: ' 1987-04-23', page_count: 471 } } },
144+ { index: { _index: 'books', data: { name: ' Pandora\ 's Star', author: ' Peter F. Hamilton', release_date: ' 2004-03-02', page_count: 768 } } },
145+ { index: { _index: 'books', data: { name: ' Revelation Space', author: ' Alastair Reynolds', release_date: ' 2000-03-15', page_count: 585 } } },
146+ { index: { _index: 'books', data: { name: ' A Fire Upon the Deep', author: ' Vernor Vinge', release_date: ' 1992-06-01', page_count: 613 } } },
147+ { index: { _index: 'books', data: { name: ' Ender\ 's Game', author: ' Orson Scott Card', release_date: ' 1985-06-01', page_count: 324 } } },
148+ { index: { _index: 'books', data: { name: ' 1984', author: ' George Orwell', release_date: ' 1985-06-01', page_count: 328 } } },
149+ { index: { _index: 'books', data: { name: ' Fahrenheit 451', author: ' Ray Bradbury', release_date: ' 1953-10-15', page_count: 227 } } },
150+ { index: { _index: 'books', data: { name: ' Brave New World', author: ' Aldous Huxley', release_date: ' 1932-06-01', page_count: 268 } } },
151+ { index: { _index: 'books', data: { name: ' Foundation', author: ' Isaac Asimov', release_date: ' 1951-06-01', page_count: 224 } } },
152+ { index: { _index: 'books', data: { name: ' The Giver', author: ' Lois Lowry', release_date: ' 1993-04-26', page_count: 208 } } },
153+ { index: { _index: 'books', data: { name: ' Slaughterhouse-Five', author: ' Kurt Vonnegut', release_date: ' 1969-06-01', page_count: 275 } } },
154+ { index: { _index: 'books', data: { name: ' The Hitchhiker\ 's Guide to the Galaxy', author: ' Douglas Adams', release_date: ' 1979-10-12', page_count: 180 } } },
155+ { index: { _index: 'books', data: { name: ' Snow Crash', author: ' Neal Stephenson', release_date: ' 1992-06-01', page_count: 470 } } },
156+ { index: { _index: 'books', data: { name: ' Neuromancer', author: ' William Gibson', release_date: ' 1984-07-01', page_count: 271 } } },
157+ { index: { _index: 'books', data: { name: ' The Handmaid\ 's Tale', author: ' Margaret Atwood', release_date: ' 1985-06-01', page_count: 311 } } },
158+ { index: { _index: 'books', data: { name: ' Starship Troopers', author: ' Robert A. Heinlein', release_date: ' 1959-12-01', page_count: 335 } } },
159+ { index: { _index: 'books', data: { name: ' The Left Hand of Darkness', author: ' Ursula K. Le Guin', release_date: ' 1969-06-01', page_count: 304 } } },
160+ { index: { _index: 'books', data: { name: ' The Moon is a Harsh Mistress', author: ' Robert A. Heinlein', release_date: ' 1966-04-01', page_count: 288 } } }
161161]
162162client.bulk(body: body)
163163----
0 commit comments