Facing some problem while trying to create lambda expression in C# with NEST in elastic search, using Nest 6.0

帅比萌擦擦* 提交于 2019-12-11 14:27:40

问题


As of now i have Elastic query with json format, now i am trying to convert this query with Nest extension for Asp.Net c# in lambda expression. Facing this problem, any body can help to create the Lambda expression with help of json query.

I have tried, but it's list type inside the query, so while i am trying giving error might be my lambda expression is not correct.

{
  "query": {
    "bool": {      
      "must": [        
        {
          "bool": {
            "should": [
              {
                "bool": {
                  "must": [
                    {
                      "term": {
                        "variant": "vxi"
                      }
                    },
                    {
                      "term": {
                        "model": "a star"
                      }
                    }
                  ]
                }
              },
              {
                "bool": {
                  "must": {
                    "terms": {
                      "model": [
                        "eeco"
                      ]
                    }
                  }
                }
              }
            ]
          }
        }
      ]
    }
  }
}

I have tried with this lambda expression, but while i am debugging then query is not creating as like json below, so need your help.

            var response = _esclient.EsClient().Search<MyClassname>(a => a
                            .Index
                            .Type
                            .Size
                            .From
                            .Query(q => q.Bool(b => b.Must(m => m.Terms(p => p.Field(ab => ab.model).Terms(searchAjaxRequest.modeltype)),
                                                               m => m.Terms(p => p.Field(ab => ab.variant).Terms(searchAjaxRequest.varientType)),

                                                           )    )))

Just want a Lambda expression in NEST ext. in c# or any tool market which i can use to create the lambda expression with help of json.

来源:https://stackoverflow.com/questions/57169462/facing-some-problem-while-trying-to-create-lambda-expression-in-c-sharp-with-nes

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