my php file is as below.
$host = ["http://localhost:9200"];
$client = Elasticsearch\ClientBuilder::create()->setHosts($host)->build();
$params = [
'index' => 'my_index',
'type' => 'my_type',
'id' => '1'
'body' => [
'doc' => [
'new_field' => 'abc'
$response = $client->update($params);
Can I update/delete/get/index multiple data at once?
Or should I loop this operation by PHP and execute
$client->update($params); as many as needed??
It is not described here
BULK API is the way to go. Much more efficient.
you mean, PHP client can't do it?
PHP client sounds bit confusing sorry.
$client->update($params); method can't update multiple data at once?
Ah, bulk api can be used through PHP client!!
But bulk seems to unable to update document partially.
It reindex whole document.
It used to have updateByQuery but it was removed from elasticsearch-php 5.0.
Is there any other way to update multiple document specific fields?
bulk API supports update requests.
about updateByQuery in PHP, I have no idea. I think it has not been added probably as it's new but I might be wrong.
However, I guess you can perform any low level HTTP REST call using the PHP client, so may be you can do it yourself?
See REST API doc: https://www.elastic.co/guide/en/elasticsearch/reference/5.1/docs-update-by-query.html
Yeah, this is the solution at the moment creating HTTP REST by my self.
I will rethink how to achieve it again.
Anyway, thanks a lot.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.