Convert simple JSON Query to Nest C#


#1

Hello Everyone,

Can someone please help me here.
I spent many hours trying to convert this simple JSON query to C# NEST (v2.0.2) syntax with no luck .

{
"fields": [],
"query": {
"match": {
"file.content": "mySearch"
}
},
"highlight": {
"fields": {
"file.content": {
"number_of_fragments": 0
}
}
}
}

this is what I tried :
var searchResults = client.Search (body =>
body.Query (query => query
.QueryString (qs => qs
.Query (mySearch)))
.Highlight (h => h
.Fields (fs => fs
.Field (p => p.File.Content).Type (HighlighterType.Fvh)
.NumberOfFragments (0)
)
)
);

changing or removing the highlighter type didn't help.

searchResults.Highlights.Count is 0
but searchResults.Documents has the right number of documents.

Thanks.


(system) #2