Elasticsearch-php: Documentation doesn't say how to update an indexed document

Created on 20 Dec 2013  路  1Comment  路  Source: elastic/elasticsearch-php

I'm trying the following and receiving an error:

$params['index'] = 'my_index';
$params['type'] = 'my_type';
$params['id'] = 'document_id';
$params['body'] = array('existing_key' => 'new_value');

$results = $client->update($params);

and I'm receiving the following error:

{"error":"ActionRequestValidationException[Validation Failed: 1: script or doc is missing;]","status":500}

Most helpful comment

I found that you can do this changing the body line to

$params['body']['doc'] = array('existing_key' => 'new_value');

>All comments

I found that you can do this changing the body line to

$params['body']['doc'] = array('existing_key' => 'new_value');
Was this page helpful?
0 / 5 - 0 ratings