@@ -90,11 +90,11 @@ Index several documents in one request:
90
90
```ruby
91
91
body = [
92
92
{ 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 },
94
94
{ index: { _index: 'books', _id: '43' } },
95
95
{ name: 'Snow Crash', author: 'Neal Stephenson', release_date: '1992-06-01', page_count: 470 },
96
96
{ 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 }
98
98
]
99
99
client.bulk(body: body)
100
100
```
@@ -134,30 +134,30 @@ First, bulk index it:
134
134
[source,ruby]
135
135
----
136
136
body = [
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 } } }
161
161
]
162
162
client.bulk(body: body)
163
163
----
0 commit comments