Implementing Highlighter when migrating from elasticsearch.net 7.17 to elastic.clients.elasticsearch 8.x

78 Views Asked by At

I am attempting to migrate from elasticsearch.net client 7.17 to elastic.clients.elasticsearch 8.x and am having trouble implementing the new syntax for the highlighter. I think the pre and post tags are the correct new syntax, but I cannot get the Fields syntax correct. The code below shows Fields using the 7.17 syntax, but I cannot find the analog in 8.x. I'm not sure whether it should still use the querydsl like that, or whether it should be a new FluentDictionary, or some other syntax.

.Highlight(h => h
    .PreTags(new List<string> { "<strong>" })
    .PostTags(new List<string> { "</strong>" })
    .Fields(fs => fs
    .Field(p => p.searchPhrase)
    )
)
0

There are 0 best solutions below