Pra*_*gam 5 elasticsearch laravel-5 laravel-scout
我试过
将弹性搜索与 Laravel scout 与包结合使用
"laravel/scout": "^1.0",
"tamayo/laravel-scout-elastic": "^1.0"
Run Code Online (Sandbox Code Playgroud)
在 localhost:9200 中运行 Elasticsearch 服务器并创建索引并提供必要的配置,
向模型添加了可搜索的特征,
并将数据导入到索引中
php artisan scout:import "App\story"
Imported [App\story] models up to ID: 4
All [App\story] records have been imported.
Run Code Online (Sandbox Code Playgroud)
但是当我进行搜索时,它返回一个空数组
story::search("the")->get()
=> Illuminate\Database\Eloquent\Collection {#754
all: [],
}
Run Code Online (Sandbox Code Playgroud)
当我卷曲时,它也显示为,
// http://localhost:9200/author/_search?pretty=true&q=*:*
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": [
]
}
}
Run Code Online (Sandbox Code Playgroud)
当我在 ES 中添加没有索引的记录时,模型会抛出类似index not found
. 但是在添加数据和所有之后,它似乎是空的。我错过了什么吗?
与 algolia 完全相同。
设置 QUEUE=sync 或者您可以关闭 config/scout.php 上的队列。
有同样的问题:https://github.com/ErickTamayo/laravel-scout-elastic/issues/43