我在生产环境中在 Kubernetes 上设置了 Meilisearch,步骤如下:https://github.com/meilisearch/meilisearch-kubernetes 在我的本地,我使用 Laravel Sail(但没有使用 Scout)。
我的本地安装和生产安装之间的主要区别是:
- 版本 - 本地为 1.2,生产为 1.4
- 文件数量 - 本地有 82K,生产有 5.5 mil
- 我通过 PHP SDK 在本地加载文档,并在生产中通过 cURL 上传 98MB 的 CSV 文件。
索引的设置似乎相同。基本搜索和其他过滤器均正常工作,排序似乎也正常工作。
curl -X GET 'http://production/indexes/posts/settings'
(我正在使用 k8s 端口转发来访问生产环境 - 它并未公开暴露)
{
"displayedAttributes": [
"*"
],
"searchableAttributes": [
"*"
],
"filterableAttributes": [
"created_at",
"doctype",
"topic_title",
"user"
],
"sortableAttributes": [
"created_at"
],
"rankingRules": [
"words",
"typo",
"proximity",
"attribute",
"sort",
"exactness"
],
"stopWords": [],
"nonSeparatorTokens": [],
"separatorTokens": [],
"dictionary": [],
"synonyms": {},
"distinctAttribute": null,
"typoTolerance": {
"enabled": true,
"minWordSizeForTypos": {
"oneTypo": 5,
"twoTypos": 9
},
"disableOnWords": [],
"disableOnAttributes": []
},
"faceting": {
"maxValuesPerFacet": 100,
"sortFacetValuesBy": {
"*": "alpha"
}
},
"pagination": {
"maxTotalHits": 1000
}
}
curl -X GET 'http://localhost:7700/indexes/posts/settings'
{
"displayedAttributes": [
"*"
],
"searchableAttributes": [
"*"
],
"filterableAttributes": [
"created_at",
"doctype",
"topic_title",
"user"
],
"sortableAttributes": [
"created_at"
],
"rankingRules": [
"words",
"typo",
"proximity",
"attribute",
"sort",
"exactness"
],
"stopWords": [],
"synonyms": {},
"distinctAttribute": null,
"typoTolerance": {
"enabled": true,
"minWordSizeForTypos": {
"oneTypo": 5,
"twoTypos": 9
},
"disableOnWords": [],
"disableOnAttributes": []
},
"faceting": {
"maxValuesPerFacet": 100
},
"pagination": {
"maxTotalHits": 1000
}
}
但是当我使用日期过滤器进行查询时,没有从生产中得到任何结果。我已确认我期望的文档存在于索引中。
curl -X POST 'http://production/indexes/posts/search' -H 'Content-Type: application/json' --data-binary '{"q": "hidden", "filter": "created_at > 1039529906"}'
{"hits":[],"query":"hidden","processingTimeMs":3,"limit":20,"offset":0,"estimatedTotalHits":0}
而在本地它工作正常
curl -X POST 'http://localhost:7700/indexes/posts/search' -H 'Content-Type: application/json' --data-binary '{"q": "hidden", "filter": "created_at > 1039529906"}'
{"hits":[...lots of hits returned ...],"query":"hidden","processingTimeMs":1,"limit":20,"offset":0,"estimatedTotalHits":106}
目前没有正在运行的任务,我昨晚加载了文档:
curl -X GET 'http://production/tasks?statuses=processing'
{"results":[],"total":0,"limit":20,"from":null,"next":null}
我的下一步是删除生产中的索引并重新加载数据。不确定这是否会有所不同。
答案1
解决方案是,我将字段设置created_at
为细绳在 CSV 中,而不是数字。
我删除了索引,重新创建并像以前一样设置它。然后重新创建并上传了created_at
设置为数字的 CSV,现在一切正常。