.net 如何使用KQL访问elasticsearchservice.search?

1qczuiv0  于 2023-03-04  发布在  .NET
关注(0)|答案(1)|浏览(102)

在Kibana中,我使用UserId:1 KQL并获得一些记录。2我想从项目中获取这些记录。3我的代码是:

KeyValuePair<string, string> sorts = new("Id", "asc");
var elasticResult = _elasticsearchService.Search<TEST>("UserId=1", 0, 50, sorts, "index").Result;

elasticResult.Item1使用以下代码返回-1值

rta7y2nd

rta7y2nd1#

您正在尝试将KQL查询用作ElasticSearch查询。UserId:1 KQL查询可能大致对应于ElasticSearch中的term查询(ElasticSearchdocs,可能是您的库的docs

相关问题