Tuesday 17 July 2018

Elasticsearch partial bulk update

I have 6kk of data to update in elasticsearch. And I have to use PHP. I search in documentation and I have found this, Bulk Indexing but this is not keeping the previous data.

I have:

[
  {
    'name': 'Jonatahn',
    'age' : 21
  }
]

My code 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 update and keep the age, but the age was deleted. Sure, I still can update data-by-data but this will take long time, is there another way to do that?



from Elasticsearch partial bulk update

No comments:

Post a Comment