【发布时间】:2016-02-18 11:20:28
【问题描述】:
我正在尝试在弹性搜索中批量上传,并且我尝试插入的每条记录都出现此错误。 请帮我解决这个问题。
{"took":2828,"errors":true,"items":[{"index":{"_index":"abc","_type":"abc","_id":"0","status":400,"error":{"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}}}}]}
这是我正在使用的代码
我正在使用 5.3 和 elasticsearch 驱动程序 1.4
<?php require_once "/var/www/ElasticSearch/models/ElasticSearchModels.php"; $params = array(); $ids = array(); for($i=0;$i<10;$i++){ $ids[] = $i; $params[] = array("here"=>"here","temp"=>"temp","pr"=>$i); } $elasticSearch = new ElasticSearch(); $elasticSearch->saveInElasticSearchBulk("products_staging","products_staging",$ids,$params); ?>
【问题讨论】:
-
您可以显示您发送的示例查询吗?
-
嘿,这是我用于批量插入的代码。
<?php require_once "/var/www/ElasticSearch/models/ElasticSearchModels.php"; $params = array(); $ids = array(); for($i=0;$i<10;$i++){ $ids[] = $i; $params[] = array("here"=>"here","temp"=>"temp","pr"=>$i); } $elasticSearch = new ElasticSearch(); $elasticSearch->saveInElasticSearchBulk("products_staging","products_staging",$ids,$params); ?> -
我想更新你的问题会更好。它会更清晰。但是我已经可以看到您没有正确构造
$params数组。 -
另外你使用的是哪个 PHP 框架?
-
我正在使用 php 5.3 和 elasticsearch php 驱动程序 1.4
标签: php elasticsearch bulkinsert