我有一份关于字段弹性搜索的json记录
"streetName": "5 Street",
"name": ["Shivam Apartments"]我尝试了以下查询,但如果在查询中添加streetName bool,它将不会返回任何内容。
{
"query": {
"bool": {
"must": [
{
"bool": {
"must": {
"match": {
"name": {
"query": "shivam apartments",
"minimum_should_match": "80%"
}
}
}
}
},
{
"bool": {
"must": {
"match": {
"streetName": {
"query": "5 street",
"minimum_should_match": "80%"
}
}
}
}
}
]
}
}
}文档映射
{
"rabc_documents": {
"mappings": {
"properties": {
"name": {
"type": "text",
"analyzer": "autocomplete_analyzer",
"position_increment_gap": 0
},
"streetName": {
"type": "keyword"
}
}
}
}
}发布于 2020-08-17 08:54:23
基于E.S文档(弹性搜索中的关键词)
考虑到上述因素的:
建议:用于部分匹配的使用"text“映射而不是”关键字“。关键字用于过滤、基于术语的聚合等。
https://stackoverflow.com/questions/63445790
复制相似问题