我正在发生一件奇怪的事情,我无法解释,也许有人可以对此有所了解。
我使用C#Nest Client。我查询客户索引。当我搜索时:
Rad
我得到4个结果: 拉多维奇 雷迪诺斯 拉丁斯基 拉达斯托维茨
当我查询:
我得到2个结果: 拉特科 拉顿斯基
现在为什么2个结果不属于Rad查询的结果列表?以及如何查询Rad并获得所有6个匹配结果?
对不起,我对弹性搜索和Nest Library还是陌生的。
索引映射:
{
"crm-customers": {
"mappings": {
"customer": {
"properties": {
"adresse": {
"properties": {
"ort": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"postleitzahl": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"strasse": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"anonymized": {
"type": "boolean"
},
"anrede": {
"type": "integer"
},
"bearbeiterId": {
"type": "integer"
},
"bearbeiterRatenkreditId": {
"type": "integer"
},
"bearbeiterVersicherungId": {
"type": "integer"
},
"createdAt": {
"type": "date"
},
"deleted": {
"type": "boolean"
},
"email": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"emailGeschaeftlich": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"familienstand": {
"type": "integer"
},
"faxPrivat": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"fullname": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"geburtstag": {
"type": "date"
},
"id": {
"type": "long"
},
"informationspflichtErfolgtAm": {
"type": "date"
},
"isEmail1Valid": {
"type": "boolean"
},
"isEmail2Valid": {
"type": "boolean"
},
"kundeSeit": {
"type": "date"
},
"leadKategorie": {
"type": "integer"
},
"leadKategorieManuelleNeuanlage": {
"type": "integer"
},
"modifiedAt": {
"type": "date"
},
"monatlichesEinkommen": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"nachname": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"personId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"telefonGeschaeftlich": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"telefonMobilPrivat": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"telefonPrivat": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"titel": {
"type": "integer"
},
"vorname": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
查询代码块:
query = query.ToLower();
var asyncResponse = await this._client.SearchAsync<Customer>(s => s
.From((page - 1) * pageSize)
.Size(pageSize)
.Index(_index)
.Sort(ss => ss
.Descending(SortSpecialField.Score)
)
.Query(q =>
(q.MatchPhrasePrefix(c =>
c.Field(p => p.Fullname)
.Boost(3)
.Query(query)
) ||
q.MultiMatch(c =>
c.Fields(f => f
.Field(p => p.Fullname)
.Field(p => p.Email)
.Field(p => p.EmailGeschaeftlich)
.Field(p => p.Adresse.Strasse)
.Field(p => p.Adresse.Ort)
).Query(query)
)) &&
(
q.Terms(c => c
.Field(p => p.BearbeiterId)
.Terms(bearbeiterIds)
) ||
q.Terms(c => c
.Field(p => p.BearbeiterRatenkreditId)
.Terms(bearbeiterIds)
) ||
q.Terms(c => c
.Field(p => p.BearbeiterVersicherungId)
.Terms(bearbeiterIds)
)
)
)
);
return asyncResponse;