我使用的是Elastic 6.0。我的kibana查询如下
!preg_match("/^(?:[\w\d-]+\.?)+@(?:(?:[\w\d]\-?)+\.)+\w{2,4}$/", $email)
给我结果
"bool": {
"must": [
{
"match": {
"relationships.relation": {
"query": "spouse"
}
}
},
{
"match": {
"relationships.first_name": {
"query": "james"
}
}
},
{
"match": {
"relationships.last_name": {
"query": "smith"
}
}
}
]
}
我只想获得第一个结果,因为它包含基于我的查询的完全匹配 { " first_name":" James S。", " last_name":" Smith", "关系":"配偶" } 我已经尝试了术语查询,但它给出了与上面相同的结果。任何建议 会有很大的帮助。
答案 0 :(得分:1)
这听起来好像relationships
映射为object
type。为了使其按预期工作,relationships
需要映射为nested
type,您应该使用nested
queries来查询嵌套对象的字段。