zoukankan      html  css  js  c++  java
  • NEST与JSON语法对照 一 match与multi_match

    JSON

    { 
      "query": {  
        "bool": {    
          "must": [   
            {        
              "multi_match": {
                "query": "一二三",       
                "fields": ["title","summary"]
                } 
                }, 
                {"match": {"userId": {"query": "123456"}}    
            }  
          ]
        }
      }
    }
    

      C#

    search.Query(
                            q => q.Bool(
                                b => b.Must(
                                    m => m.MultiMatch(
                                        l => l.Query("一二三").OnFields(new[] {"title","summary"})
                                       ),
                                       m => m.Match(t => t.OnField(o => o.UserId).Query("123456"))
                                    )
                                )
                            )

    当然如果是Json 

    {"match": {"userId": {"query": "123456"}} <br>也可以表述为
    

      

    {"match": {"userId":"123456"}<br><br>其中OnField/OnFields可以使用lamdba 表达式来选择属性,也可以使用字符串<br><br>
  • 相关阅读:
    Emacs for OIer 的一些配置
    CF1336E Chiori and Doll Picking 【线性代数,组合计数】
    CF605E Intergalaxy Trips 【贪心,动态规划,期望】
    Luogu6329 【模板】点分树 | 震波
    [SDOI2014]数表
    [BZOJ4403]序列统计
    [BZOJ5099]Pionek
    SP1812 LCS2
    SA & SAM
    [HAOI2016]找相同字符
  • 原文地址:https://www.cnblogs.com/guozhe/p/5124209.html
Copyright © 2011-2022 走看看