首页 > 解决方案 > 将所有查询与弹性搜索索引匹配

问题描述

看着这个,我想知道是否也可以简单地通过字符串搜索索引,例如:

Hello World

并接收未绑定到显式实体的数据。一些伪代码:

 var searchResponse = client.Search(MatchAllQuery ...?, index=someIndex, q="Hello World")

标签: c#elasticsearch

解决方案


你可以试试这个:

var searchResponse = client.Search<Document>(sd => sd
    .Index("index_name")
    .Type("type")
    .Size(10000)
    .Query(q => q
        .Match(m => m.Field("TextID").Query("Hello World")
        )));

推荐阅读