ElasticSearch NEST查询 [英] ElasticSearch NEST Query

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

问题描述

我试图模仿在C#中使用NEST写入Sense(chrome插件)中的查询。我不知道两个查询之间的区别是什么。当查询查询没有时,Sense查询返回记录。查询如下:

I'm trying to mimic a query that I wrote in Sense (chrome plugin) using NEST in C#. I can't figure out what the difference between the two queries is. The Sense query returns records while the nest query does not. The queries are as follows:

var searchResults = client.Search<File>(s => s.Query(q => q.Term(p => p.fileContents, "int")));

{
"query": {
    "term": {
       "fileContents": {
          "value": "int"
       }
    }
}

这两个查询有什么区别?为什么会返回记录而另一个不是?

What is the difference between these two queries? Why would one return records and the other not?

推荐答案

您可以使用以下代码了解NEST使用什么查询: p>

You can find out what query NEST uses with the following code:

var json = System.Text.Encoding.UTF8.GetString(searchResults.RequestInformation.Request);

然后可以比较输出。

这篇关于ElasticSearch NEST查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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