如何使用elasticsearch php对子文档进行CRUD
我正在使用ElasticSearchPHP。我想新建、更新、删除子文档 对于父文档,我可以使用如何使用elasticsearch php对子文档进行CRUD,php,elasticsearch,Php,elasticsearch,我正在使用ElasticSearchPHP。我想新建、更新、删除子文档 对于父文档,我可以使用 $Params = array(); $Params ['index'] = 'vision'; $Params ['type'] = 'type'; $Params ['id'] = 1590353; $Params ['body']['doc'] = array('field' => 'value'); $re
$Params = array();
$Params ['index'] = 'vision';
$Params ['type'] = 'type';
$Params ['id'] = 1590353;
$Params ['body']['doc'] = array('field' => 'value');
$retUpdate = $client->update($Params );
但对于子文档,我总是会出错
{"error":"RoutingMissingException[routing is required for [vision]/[child_type]/[1590354]]","status":400}
我怎么做
我想那是因为路线 通过家长,我可以访问URL:localhost:9200/vision/mt_customer/1590354?pretty
但是我在访问子文档时遇到了路由错误:localhost:9200/vision/child_type/12314?pretty刚刚发现问题。对于子文档,我们需要将父文档添加到索引中 例如:
$searchParams['index'] = 'vision';
$searchParams['type'] = 'child_type';
$searchParams['id'] = 156728;
$searchParams['parent'] = 1791035;
将$Params['body']=array('field'=>'value');工作??那是不工作的。相同错误“Elasticsearch\Common\Exceptions\BadRequest400Exception[400]:{”错误“:“RoutingMissingException[视觉]/[wk_呼叫列表]/[156728]]需要路由”,“状态:400}”。我认为这是因为子文档可以获得请求的json等价物吗?我认为这是因为路由:使用父文档:curl-XPOST“localhost:9200/vision/mtu customer/\u update”-d“{”sales\:“5\”}”。我对子文档使用了相同的方法,但出现了错误。