我是否应该构建一个自动补全的“智能”,在这个意义上,每个结果都必须在一系列信息后面使用。
例如:
我正在寻找"bologna“,我必须运行一个查询(或者多个,我正在寻找一种方法使它尽可能少),在”名称“,”位置“和”区域“字段中搜索"bologna”。
如果发现,有必要统计“博洛尼亚”中有多少个结构。
这是数据库模式:
index:
analysis:
analyzer:
custom_search_analyzer:
type: custom
tokenizer: standard
filter : [standard, snowball, lowercase, asciifolding]
custom_index_analyzer:
type: custom
tokenizer: standard
filter : [standard, snowball, lowercase, asciifolding, custom_filter]
filter:
custom_filter:
type: edgeNGram
side: front
min_gram: 1
max_gram: 20
{
"structure": {
"properties": {
"name": {"type": "string", "search_analyzer": "custom_search_analyzer", "index_analyzer": "custom_index_analyzer"},
"locality": {"type": "string", "search_analyzer": "custom_search_analyzer", "index_analyzer": "custom_index_analyzer"},
"province": {"type": "string", "search_analyzer": "custom_search_analyzer", "index_analyzer": "custom_index_analyzer"},
"region": {"type": "string", "search_analyzer": "custom_search_analyzer", "index_analyzer": "custom_index_analyzer"}
}
}
}显然,我可以在服务器端做到这一点,例如用php和一个循环,但答案会非常慢,并受挫于elasticsearch的速度。
在这一点上,我想知道我怎么能做到这一点。
发布于 2015-07-15 21:13:25
我已经成功地使用了this guide,它满足了您提到的多字段需求。
https://stackoverflow.com/questions/21768298
复制相似问题