【发布时间】:2017-04-02 02:26:37
【问题描述】:
在 Elasticsearch 上使用 C# NEST API:
var searchResults = client.Search<Product>(s => s
.Index(Constants.ElasticSearchIndex)
.Query(q => q
.Raw(jsonRequest)
)
);
该查询应该在 /sc_all/ 索引上运行,但它在 /sc_all/product/ 索引上运行(它不存在 - /product/ 似乎是由于自 T = product 的搜索而添加的)。
如果我这样做, /product/ 将替换为常量的值,即 /sc_all/product/ => /sc_all/constant_value/:
var searchResults = client.Search<Product>(s => s
.Index(Constants.ElasticSearchIndex)
.Type(Constants.ElasticSearchType)
.Query(q => q
.Raw(jsonRequest)
)
);
如果我只想查询 /sc_all/ 而没有别的,该怎么办?
谢谢!
Json 请求:
"{\"filtered\": {\"query\": {\"match_all\": { }},\"filter\": {\"nested\" : {\"path\" : \ "products\",\"filter\": {\"nested\" : {\"path\" : \"products.da\",\"filter\": { \"bool\": { \"必须\": [{\"query\": {\"query_string\": {\"default_field\" : \"products.da.content\", \"query\" : \"kildemoes\"}}}] }}}}}}}},\“来自\”:0,\“大小\”:100“
【问题讨论】:
标签: c# search elasticsearch nest