【发布时间】:2020-09-15 14:17:12
【问题描述】:
我要求能够搜索完整或带前缀的句子。我正在使用的 UI 库(反应式搜索)以这种方式生成查询:
"simple_query_string": {
"query": "\"Louis George Maurice Adolphe\"",
"fields": [
"field1",
"field2",
"field3"
],
"default_operator": "or"
}
我期待它返回结果,例如。
Louis George Maurice Adolphe (Roche)
但不仅仅是包含部分术语的记录,如 Louis 或 George
目前,我有这样的代码,但是如果我使用完整的单词 Louis George Maurice Adolphe (Roche) 而不是前缀 Louis George Maurice Adolphe 进行搜索,它只会带来记录。
{
"settings": {
"analysis": {
"char_filter": {
"space_remover": {
"type": "mapping",
"mappings": [
"\\u0020=>"
]
}
},
"normalizer": {
"lower_case_normalizer": {
"type": "custom",
"char_filter": [
"space_remover"
],
"filter": [
"lowercase"
]
}
}
}
},
"mappings": {
"_doc": {
"properties": {
"field3": {
"type": "keyword",
"normalizer": "lower_case_normalizer"
}
}
}
}
}
感谢您对上述内容的任何指导。谢谢。
【问题讨论】:
标签: elasticsearch reactivesearch