我需要幫忙。我有一個 cross_fields multi_match 查詢,我需要為每個欄位使用命名查詢。我可以將其重寫為 bool/should 匹配,但隨后我不知道如何重現 cross_fields 條件。任何的想法?謝謝!
多匹配查詢:相關性確定,但沒有命名查詢
GET test_index/_search
{
"query": {
"multi_match": {
"query": "example_query",
"fields": ["name","lastname"],
"type": "cross_fields"
}
}
}
布爾查詢:命名查詢正常但相關性差
GET test_index/_search
{
"query": {
"bool": {
"should": [
{
"match": {
"name": {
"query": "example query",
"_name": "name_match"
}
}
},
{
"match": {
"latname": {
"query": "example query",
"_name": "latname_match"
}
}
}
]
}
}
}
uj5u.com熱心網友回復:
如何使用dismaxwithtie_breaker: 1.0為您的 ES 索引作業?
像這樣的東西:
GET vehicle/_search
{
"query": {
"dis_max": {
"tie_breaker": 1.0,
"queries": [
{
"match": {
"make": {
"query": "Lamborghini",
"_name": "make"
}
}
},
{
"match": {
"model": {
"query": "Diablo",
"_name": "model"
}
}
}
]
}
}
}
該Dismax查詢是非常相似的multi_match,因為它比較跨子條款/查詢成績查詢。該tie_breaker引數控制有多少丟失/非最大欄位對子句分數的最終總和做出了貢獻,任何丟失的欄位分數都乘以tie_breaker. 默認值tie_breaker: 0.0,與type: best_fieldsin最相似multi_match。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/320913.html
標籤:弹性搜索
