因此,我成功創建了「包」對象的索引,並且直接轉發的文本查詢功能完美。在ElasticSearch上使用NEST - 我如何使用部分填充的對象作爲搜索條件
我很想知道是否/如何使用部分填充的對象(類型爲「Package」)作爲我的搜索條件?
包看起來像:
var packages = new List<Package> {
new Package {
Name = "Maverick",
TargetBusiness = new Business {
Industry = "Retail",
BusinessType = BusinessType.Product,
LocationType = LocationType.Store
},
Description = "Standard package for retail shops"
},
new Package {
Name = "Goose",
TargetBusiness = new Business {
Industry = "Retail",
BusinessType = BusinessType.Product,
LocationType = LocationType.Online
},
Description = "Standard package for ecommerce shops"
},
new Package {
Name = "Viper",
TargetBusiness = new Business {
Industry = "Advertising",
BusinessType = BusinessType.Service,
LocationType = LocationType.Office
},
Description = "Standard package test retail"
}
}
查詢目前看起來是這樣的:
var result = client.Search<Package>(x => x.Query(q => q.QueryString(qs => qs.Query("q=retail"))));
但我還想有類似:
var result = client.Search<Package>(x => x.Query(q => q.Object(new Package{...etc ...})));
我希望我做感:D 在此先感謝
好吧,這意味着搜索每個財產對每一個其他財產權利? –
是的,雖然你可以很容易地用「field:value」語法替換它,但這可能是要添加到NEST中的一些東西。我需要讓這個想法沉入一點:) –