-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Labels
Description
That's what the official document says:
Bulk indexing with PHP arrays.
for($i = 0; $i < 100; $i++) {
$params['body'][] = [
'index' => [
'_index' => 'my_index',
]
];
$params['body'][] = [
'my_field' => 'my_value',
'second_field' => 'some more values'
];
}
$responses = $client->bulk($params);
The above array structure is confusing, so why not do it:
for($i = 0; $i < 100; $i++) {
$params[] = [
'index' => [
'_index' => 'my_index',
'_id' => $i
],
'body' => [
'my_field' => 'my_value',
'second_field' => 'some more values'
]
];
}
$responses = $client->bulk($params);
- Operating System win10
- PHP Version 8
- ES-PHP client version lasted
- Elasticsearch version 8