【发布时间】:2015-01-30 16:06:13
【问题描述】:
关于问题: Elasticsearch/Nest - using MatchPhrase with OnFieldsWithBoost
我有一个看起来像这样的索引:
{
"_index": "myIndex",
"_type": "Page",
"_id": "119",
"_score": 0.104187615,
"_source": {
"dataBaseId": 119,
"category": "InfoPage",
"type": "Page",
"metaTitle": "myMeta",
"metaDescription": "Description",
"rawText": "my search text"
}
}
我的代码如下所示:
var result = ElasticClient.Search<SearchReportDocument>(s => s
.Index("myIndex")
.Type("Page")
.Size(10)
.Query(q =>
q.MultiMatch(m => m.OnFieldsWithBoost(f => f.Add(b => b.MetaTitle, 5).Add(b => b.RawText, 1)).Type(TextQueryType.PhrasePrefix).Query(searchQuery))
)
);
我想将其扩展为仅返回“类别”等于 InfoPage 的结果。
【问题讨论】:
标签: c# elasticsearch nest