In relation to the question: Elasticsearch/Nest - using MatchPhrase with OnFieldsWithBoost
I have an index which looks something like this:
{
"_index": "myIndex",
"_type": "Page",
"_id": "119",
"_score": 0.104187615,
"_source": {
"dataBaseId": 119,
"category": "InfoPage",
"type": "Page",
"metaTitle": "myMeta",
"metaDescription": "Description",
"rawText": "my search text"
}
}
My code looks like this:
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))
)
);
I would like to extend it to only return results which has "category" equal to InfoPage.