得到了一些與NEST相關的問題。以下是ES中的一些文檔。NEST Fluent DSL查詢一些URL字段
正如你可以看到我已經插入我的ES一些條目。我試着做一些這樣的查詢:
var response = elastic.Search<ESIntegrationLog>(s => s
.Index("20160806")
.Type("esintegrationlog")
.Query(q =>
q.Term(p => p.CalledBy, "lazada")
)
.Sort(ss => ss.Descending(p => p.CalledOn))
.Take(300)
);
結果如我所料,我找到了入口。但是當我試圖用'callPoint'查詢時,我無法找到任何結果。下面是代碼:
var response = elastic.Search<ESIntegrationLog>(s => s
.Index("20160806")
.Type("esintegrationlog")
.Query(q =>
q.Term(p => p.CallPoint, "/cloudconnect/api/xxxxxxx/v1")
)
.Sort(ss => ss.Descending(p => p.CalledOn))
.Take(300)
);
我已經嘗試編碼URL,但仍然沒有發現任何東西。有任何想法嗎?
更新:我使用「匹配」解決案例。
.Query(q =>
//q.Term(p => p.CallPoint, "abcdefg")
q.MatchPhrasePrefix(c=> c.Field(d=> d.CallPoint).Query("/cloudconnect/api/xxxxxxx/v1"))
)
謝謝。幫助我很多。 – dausdashsan
不用擔心,很高興幫助:) –