【发布时间】:2022-01-20 17:00:38
【问题描述】:
我正在尝试将搜索词部分匹配到给定架构以进行自动完成。我希望 customerNumber 和 AddressLine1 和 Zip 匹配以 419 开头的任何文档(因此 4191 应该匹配客户编号 41915678 和地址 4191 Board Street 和邮政编码 41912)
"mappings": {
"companyName": {
"type": "text"
},
"customerNumber": {
"type": "long"
}
"address": {
"addressLine1": {
"type": "text"
},
"city": {
"type": "text"
},
"state": {
"type": "text"
},
"zip": {
"type": "text"
}
}
}
有人对查询有很好的解决方案吗?最终我需要使用 NEST 客户端将此查询转换为 C#。
【问题讨论】:
-
你的数据量大概是多少?
-
您可以在映射中使用前缀查询(查询时间慢)或边 n-gram(索引时间慢)。
-
90 万条记录,但数据相当静态。
-
谁能协助n-gram查询?缓慢的索引时间比缓慢的查询时间更容易接受。
标签: elasticsearch nest