我需要找更多的权重给教授
然后下一个获得权重的属性是professor.email
下面检查搜索字符串所在的其他字段是elasticsearch中的示例数据
PUT /data/test/1
{
"id": "Accounting 101",
"room": "E3",
"professor": {
"name": "Thomas Baszo",
"email": "baszot@onuni.com"
},
"students_enrolled": 27,
"course_description": " financial statements"
}
PUT /data/test/2
{
"name": "Accounting 101",
"room": "E3",
"professor": {
"name": "Sachin Baszo",
"email": "baszot@onuni.com"
},
"students_enrolled": 27,
"course_description": "Thomas Thomas Thomas Thomas "
}
PUT /data/test/3
{
"name": "Accounting 101",
"room": "E3",
"professor": {
"name": "Sachin Baszo",
"email": "Thomas@onuni.com"
},
"students_enrolled": 27,
"course_description": "Nothing"
}
下面是查询
获取/\u搜索 {"from" : 0, "size" : 100,"query": {"match_all": {}}})
如何实施 "fields": [ "professor.name^16", "professor.email^8"]
1条答案
按热度按时间brvekthn1#
您可以使用匹配查询上的多字段匹配查询生成来允许多字段查询:
搜索查询:
搜索结果: