ElasticSearch NEST Search

匿名 (未验证) 提交于 2019-12-03 03:10:03

问题:

I'm encountering an unexpected error when I try to perform a search on an ElasticSearch instance. I'm following the documentation here (http://nest.azurewebsites.net/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")     )  ); 

回答1:

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.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!