php - 使用 scout 包在 laravel 弹性搜索中找不到索引异常
问题描述
我已经安装了laravel 的 tamayo/laravel-scout-elastic包,并且我确实导入了我的产品表记录,但是每当我搜索任何内容时,我都会收到“未找到索引异常”。下面是我对scout.php文件的配置
`'elasticsearch' => [
'index' => env('ELASTICSEARCH_INDEX', 'marketplace'),
'hosts' => [
env('ELASTICSEARCH_HOST', 'http://localhost:9200'),
],
],`
当我这样做时curl 'localhost:9200/marketplace/_mapping?pretty'
,我得到了以下回复。
`{
"error" : {
"root_cause" : [ {
"type" : "index_not_found_exception",
"reason" : "no such index",
"resource.type" : "index_or_alias",
"resource.id" : "marketplace",
"index" : "marketplace"
} ],
"type" : "index_not_found_exception",
"reason" : "no such index",
"resource.type" : "index_or_alias",
"resource.id" : "marketplace",
"index" : "marketplace"
},
"status" : 404
}`
我错过了那里的东西吗?任何帮助将非常感激。
解决方案
您是否通过 URL http://localhost:9200/marketplace 使用 PUT 方法添加了索引?(使用 cli。curl --location --request PUT 'http://localhost:9200/some_index')
推荐阅读
- c# - 为什么我的网站在使用 www 时无法访问?网
- r - 每次我将它编织成pdf时,如何避免rmd文件执行整个R脚本?
- reactjs - 向 Firestore 默认文档 ID 添加前缀
- r - 如何连接/组合两个相同长度的矩阵以“填充”其中一个矩阵的空白?问题
- javascript - JavaScript:将值记录到控制台时触发事件
- amazon-web-services - 使用 AWS CLI 列出某些托管策略
- reactjs - Shopify App - 如何使用 App Proxy 在主题中注入 React?
- android - 我的第一个 Flutter 应用程序构建中的文本字段问题
- javascript - 如何在 Ant Design 的 Form.Item 中为 DatePicker 使用 initialValue
- opencv - 使用c ++将pb和pbtxt从python tensorflow导出到opencv