【发布时间】:2018-04-16 20:29:40
【问题描述】:
我用 elasticsearch 索引了大约 1,000,000 行,现在想索引其他一些行,但出现此错误:
致命错误:未捕获 Elasticsearch\Common\Exceptions\RuntimeException:需要索引 对于索引 C:\wamp64\www\myProject...\elastic\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Endpoints\Index.php 第 55 行
我写 php,这是我的代码:
<?php
/*
* index document module
*/
public function insert_node ($id) {
// 1 - set connection
// code
// 2 - get data from mysql query
// code
// 3 - assign data to $row array in foreach
// code
// 4 - set $params array for index
$params['body'][] = [
'_index' => 'users',
'_type' => 'user'
];
$params['body'][] = [
'id' => $row['id'],
'name' => $row['name'],
'phone' => $row['phone'],
'province' => $row['province'],
'credit' => $row['credit'],
...
];
// 5 - index data
$responses = $client -> index ($params);
}
【问题讨论】:
-
指定索引名称?
-
是的,我用 php 编写弹性文件,这是我的代码