弹性搜索NEST搜索 [英] ElasticSearch NEST Search

查看:161
本文介绍了弹性搜索NEST搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在ElasticSearch实例上执行搜索时,遇到意外的错误。我在这里遵循文档( http://nest.azurewebsites.net/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 (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")
    )
 );


推荐答案

你的问题可能是关于字符的情况,如果将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搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆