当我尝试在ElasticSearch实例上执行搜索时,遇到意外的错误。我在这里遵循文档( nest.azurewebsites/nest/quick-start.html )逐字,但我得到错误错误1无法将lambda表达式转换为类型Nest.SearchDescriptor,因为它不是委托类型。s => s的第一个被突出显示。也许这只是一个C#语法问题,任何想法?
I'm encountering an unexpected error when I try to perform a search on an ElasticSearch instance. I'm following the documentation here (nest.azurewebsites/nest/quick-start.html) verbatim, but I"m getting the error "Error 1 Cannot convert lambda expression to type 'Nest.SearchDescriptor' because it is not a delegate type." The first s of "s => s" is being highlighted. Maybe it's just a C# syntax issue. Any ideas?
var searchResults = client.Search<Person>(s=>s .From(0) .Size(10) .Query(q=>q .Term(p=>p.Firstname, "martijn") ) );推荐答案
你的问题可能是关于字符的情况,如果将FirstName字段添加到Person对象中,那么需要在lambda表达式中将其写为FirstName not Firstname。
I had the same problem. Your problem is probably about character case. If you add FirstName field to Person object, then you need to write it as FirstName not Firstname, inside the lambda expression.
更多推荐
弹性搜索NEST搜索
发布评论