Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Elasticsearch嵌套客户端MatchPhrasePrefix_C#_.net_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Nest - Fatal编程技术网 elasticsearch,nest,C#,.net,elasticsearch,Nest" /> elasticsearch,nest,C#,.net,elasticsearch,Nest" />

C# Elasticsearch嵌套客户端MatchPhrasePrefix

C# Elasticsearch嵌套客户端MatchPhrasePrefix,c#,.net,elasticsearch,nest,C#,.net,elasticsearch,Nest,我正在发生一件奇怪的事情,我无法解释,也许有人可以解释一下 我使用C#Nest客户端。我查询客户索引。当我搜索: 拉德 我得到4个结果: 拉多维奇 拉迪诺斯特 拉丁斯基 拉达斯托维茨 当我查询: 雷德 我得到两个结果: 拉德科 拉通斯基 现在为什么这两个结果不是Rad查询结果列表的一部分?我如何查询Rad并获得所有6个匹配结果 抱歉,我对elastic search和Nest Library还相当陌生 索引映射: { "crm-customers": { "mapping

我正在发生一件奇怪的事情,我无法解释,也许有人可以解释一下

我使用C#Nest客户端。我查询客户索引。当我搜索:

拉德

我得到4个结果: 拉多维奇 拉迪诺斯特 拉丁斯基 拉达斯托维茨

当我查询: 雷德

我得到两个结果: 拉德科 拉通斯基

现在为什么这两个结果不是Rad查询结果列表的一部分?我如何查询Rad并获得所有6个匹配结果

抱歉,我对elastic search和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=等待此消息。\u client.SearchAsync(s=>s
.From((第1页)*页面大小)
.Size(页面大小)
.Index(_Index)
.Sort(ss=>ss
.下降(SortSpecialField.得分)
)
.Query(q=>
(q.MatchPhrasePrefix(c=>
c、 字段(p=>p.Fullname)
.Boost(3)
.Query(查询)
) ||
q、 多重匹配(c=>
c、 字段(f=>f
.Field(p=>p.Fullname)
.Field(p=>p.Email)
.Field(p=>p.EmailGeschaeftlich)
.Field(p=>p.address.Strasse)
.Field(p=>p.address.Ort)
).Query(查询)
)) &&
(
q、 术语(c=>c
.Field(p=>p.BearbeiterId)
.条款(比目鱼)
) ||
q、 术语(c=>c
.Field(p=>p.bearbeitertertenkreditid)
.条款(比目鱼)
) ||
q、 术语(c=>c
.Field(p=>p.BearbeiterVersionRungid)
.条款(比目鱼)
)
)
)
);
返回异步响应;

您可以分享您的索引映射吗?您可以通过
get localhost:9200/indexname/_mapping
获得它。如果您可以包括您迄今为止尝试过的搜索请求,您对搜索请求的确切含义是什么?如何搜索“Rad”?您使用哪种查询类型?我使用嵌套库和.query(q=>q.MatchPhrasePrefix(c=>c.Field(p=>p.Fullname).Boost(3.query(“Rad”))