第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Elasticsearch.NET & NEST - 搜索總是返回 0 個結(jié)果

Elasticsearch.NET & NEST - 搜索總是返回 0 個結(jié)果

C#
動漫人物 2021-07-08 17:11:22
我正在嘗試使用該ElasticClient.Search方法進(jìn)行搜索,但無論我設(shè)置什么術(shù)語或搜索字段,我總是得到 0 個結(jié)果。這是我的 POCO 的結(jié)構(gòu):public class MyParent{    public MyChild MyChild { get; set; }}public class MyChild{    public string MyField { get; set; }}然后這是我的實際搜索代碼:string searchTerm = "myChild.myField";string searchValue = "C";Field searchField = new Field(searchTerm);ISearchResponse<MyParent> result =    Client.Search<MyParent>(s =>        s.Query(q => q.Term(searchField, searchValue)));if (result != null &&     result.Documents != null &&     result.Documents.Count != 0){    ...}任何幫助表示贊賞!
查看完整描述

1 回答

?
冉冉說

TA貢獻(xiàn)1877條經(jīng)驗 獲得超1個贊

發(fā)現(xiàn)問題了。我沒有設(shè)置索引!我將我的搜索代碼更改為這個并且它有效:


ISearchResponse<MyParent> result =

    Client.Search<MyParent>(s =>

        s.Index("my_index_").Query(q => q.Term(searchField, searchValue)));


查看完整回答
反對 回復(fù) 2021-07-10
  • 1 回答
  • 0 關(guān)注
  • 247 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號