0
我需要尽可能快地索引大约1000个文档。我决定使用大约比原始解决方案快10倍的批量功能。我需要在索引结束后立即输入refresh以使文档可搜索。在其他情况下,我会使用刷新参数'refresh'=> true,但我不能让它在PHP中使用批量。我使用code from official documentation。ElasticSearch - 带刷新的批量索引
for($i = 0; $i < 100; $i++) {
$params['body'][] = [
'index' => [
'_index' => 'my_index',
'_type' => 'my_type',
]
];
$params['body'][] = [
'my_field' => 'my_value',
'second_field' => 'some more values'
];
}
$responses = $client->bulk($params);
在PHP批量函数中使用刷新的正确方法是什么?