es:init 报错
来源:9-7 使用laravel的Command实现搜索引擎索引和模版的建立

炜炜炜
2018-02-13
1,按照视频的代码,执行 php artisan es:init --->404
2,看到其他同学的问题,注释掉 两处的 $client->delete($url) ---->500
浏览器访问上述报错链接
我的打码:
public function handle() { // 创建template $client = new Client(); $url = config('scout.elasticsearch.hosts')[0] . '/_template/tmp/'; //$client->delete($url); $param = [ 'json' => [ 'template' => config('scout.elasticsearch.index'), 'mappings' => [ '_default_' => [ 'dynamic_templates'=>[ [ 'strings' => [ 'match_mapping_type' => 'string', 'mapping' => [ 'type' => 'text', 'analyzer' => 'ik_smart', 'fields' => [ 'keyword' => [ 'type' => 'keyword' ] ] ] ] ] ] ], ], ], ]; $client->put($url, $param); $this->info('======== 创建模版成功 ========'); // 创建index $url = config('scout.elasticsearch.hosts')[0] . '/' . config('scout.elasticsearch.index'); //$client->delete($url); $param = [ 'json' => [ 'settings' => [ 'refresh_interval' => '5s', 'number_of_shards' => 1, 'number_of_replicas' => 0, ], 'mappings' => [ '_default_' => [ '_all' => [ 'enable' => false ] ] ] ] ]; $client->put($url, $param); $this->info('======== 创建索引成功 ========'); }
写回答
1回答
-
轩脉刃
2018-02-24
你可以看看这篇文章先:https://www.imooc.com/article/22449
012019-12-03
相似问题