<?php
require '../vendor/autoload.php';
function p ($param) {
if (!is_array($param) && !is_object($param))
{
echo $param;
return true;
}
echo '<pre>';
print_r($param);
echo '</pre>';
}
$client = new Elasticsearch\Client();
//创建索引/添加mapping/到批量添加数据
//bulking (批量添加数据)
$indexParam['index'] = 'info'; //info库
// $indexParam['type'] = 'news';//新闻信息
// $indexParam['body']['settings'] = array(
// //设置setting信息
// 'number_of_shards' => 3,//1个索引分3片
// 'number_of_replicas' => true,//保留一个副本
// // 'refresh_interval' => -1
// );
//创建mapping
$mapParam = array(
'_source' => array(
'enable' => true
),
'properties' => array(
'title' => array(
'type' => 'string',
分布式搜索引擎elasticsearch PHP API index bulk 批量插入操作
最新推荐文章于 2022-10-19 21:41:24 发布