I have 6k
of data to update in ElasticSearch. And I have to use PHP
.
I search in the documentation and I have found this, Bulk Indexing but this is not keeping the previous data.
I have structure:
[
{
'name': 'Jonatahn',
'age' : 21
}
]
My code snippet to update:
$params =[
"index" => "customer",
"type" => "doc",
"body" => [
[
"index" => [
"_index" => "customer",
"_type" => "doc",
"_id" => "09310451939"
]
],
[
"name" => "Jonathan"
]
]
];
$client->bulk($params);
When I send ['name' => 'Jonathan']
I expect the name
will be updated and keep the age
, but the age
gets deleted.
Sure, I still can update data-by-data but this will take a long time, is there any better way to do that?