github 地址:https://github.com/medcl/elasticsearch-analysis-ik
集成包地址:https://github.com/medcl/elasticsearch-rtf
1:下载集成包
2:进入目录->解压
3:查看插件列表:
4:如果内存过小:
拷贝插件:
删除掉除开analysis-ik的所有插件
执行删除操作:
5:最后
7:启动服务
查看是否启动:
如果没有启动:执行命令
./bin/elasticsearch 注意 这里执行命令必须要在安装目录下
最后 浏览器地址输入:
安装laravel 使用elastic的包:
安装scout:
地址:http://d.laravel-china.org/docs/5.4/scout
安装 scout 的es 渠道
地址:https://github.com/ErickTamayo/laravel-scout-elastic
在 laravel 中使用命令(增加命令行):
php artisan make:command ESInit
然后修改参数
执行 php artisan
引入:guzzlehttp/guzzle
在 esinit.php 中
/** * Execute the console command. * * @return mixed */ public function handle() { $client = new Client(); // 创建模版 $url = config('scout.elasticsearch.hosts')[0] . '/_template/tmp'; $client->put($url, [ 'json' => [ 'template' => config('scout.elasticsearch.index'), 'settings' => [ 'number_of_shards' => 1 ], 'mappings' => [ '_default_' => [ '_all' => [ 'enabled' => true ], 'dynamic_templates' => [ [ 'strings' => [ 'match_mapping_type' => 'string', 'mapping' => [ 'type' => 'text', 'analyzer' => 'ik_smart', 'ignore_above' => 256, 'fields' => [ 'keyword' => [ 'type' => 'keyword' ] ] ] ] ] ] ] ] ] ]); $this->info('=====创建模板成功====='); // 创建 index $url = config('scout.elasticsearch.hosts')[0] . '/' . config('scout.elasticsearch.index'); $client->put($url, [ 'json' => [ 'settings' => [ 'refresh_interval' => '5s', 'number_of_shards' => 1, 'number_of_replicas' => 0, ], 'mappings' => [ '_default_' => [ '_all' => [ 'enabled' => false ] ] ] ] ]); $this->info('=====创建索引成功====='); }
修改模型
重写方法:
执行命令:
es:init;
简简单单:你这个是什么啊
2017-08-05 09:03:43 回复
心若空丶初夏:哈哈
2017-08-04 10:17:13 回复