整合搜索到ES

2019-08-21  本文已影响0人  段义纬

1、elasticsearch的安装就跳过了,搜轮子:https://packagist.org/?query=scout%20%20elastic
步骤参考:https://github.com/babenkoivan/scout-elasticsearch-driver#search-rules

2、记录下其他细节或坑

参考: https://www.elastic.co/guide/en/elasticsearch/guide/current/_creating_an_index.html
https://www.elastic.co/guide/en/elasticsearch/reference/6.7/removal-of-types.html
该库也是将settings放到IndexConfigurator中的,mapping放到各自model中的;

参考:https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#request-body-search-highlighting

是因为我把SCOUT_ELASTIC_DOCUMENT_REFRESH设成了false,改为true即可

由于文档说config/scout.php中queue配置成true,性能会提高,所以果断.env中设成true,然后参考https://laravel.com/docs/5.8/scout#indexing,执行

php artisan scout:import "App\Services\Subject\Models\Subject"

然后刷新:http://127.0.0.1:9200/_cat/indices?v,一直没见docs.count变多,所以只好先把queue设为false,再次执行上面的命令即可。

参考:https://github.com/laravel/scout/issues/302

keyword:laravel | elasticsearch | ES | 搜索 | scout

上一篇 下一篇

猜你喜欢

热点阅读