为什么要在C#中使用NEST客户端,而不通过弹性搜索JSON查询直接查询弹性搜索服务器? [英] Why use NEST client in C# and not directly query elastic search server through elastic search JSON query?

查看:259
本文介绍了为什么要在C#中使用NEST客户端,而不通过弹性搜索JSON查询直接查询弹性搜索服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们总是在意义上创建弹性搜索查询,然后在NEST中创建它的相应版本.

We always create elastic search query in sense and then create corresponding version of it in NEST.

使用NEST客户端而不直接放置JSON弹性搜索查询以获取搜索文档的好处是什么?

What is benefit of using NEST client and not directly putting JSON elastic search query to get back search documents?

推荐答案

以下是您可能会选择使用Elasticsearch的高级客户端NEST的原因的详尽列表:

Here's a non-exhaustive list of reasons why you might choose to use NEST, the high level client for Elasticsearch:

  • .NET 4.5,.NET 4.6和.NET Standard 1.3(及更高版本)支持和测试
  • 所有按类型建模的请求和响应
  • 允许将文档建模为普通旧CLR对象(PO​​CO)
  • 所有映射的Elasticsearch API
  • 使用lambda表达式的强大流畅的API使构建查询变得更加容易.包括无条件查询等功能.
  • 如果希望将对象组合在一起而不是使用流畅的API,则可以使用对象初始化器API
  • 如果需要使用字符串,字节数组,匿名类型执行请求,则公开低级客户端.允许混合和匹配具有更多原始类型的请求/响应类型
  • 自动故障转移和重试语义
  • 对端点有效响应的内在知识,例如找不到文档的404响应仍可以视为有效响应
  • 可观察到的帮助程序方法,可用于更长的运行时间,例如BulkAllScrollAllReindex
  • 由Elastic维持为正式客户,由社区做出了巨大贡献(谢谢!).包括从源代码构建的文档,以减轻从源代码的漂移,并使持续改进变得更容易
  • 可插拔组件,例如IConnectionIRequestPipelineIElasticsearchSerializer
  • Supported and tested with .NET 4.5, .NET 4.6 and .NET Standard 1.3 (and above)
  • All requests and responses modelled as types
  • Allows documents to be modelled as Plain Old CLR Objects (POCOs)
  • All Elasticsearch APIs mapped
  • Powerful fluent API using lambda expressions makes building queries much easier. Includes features such as conditionless queries.
  • An object initializer API if you prefer to compose objects together, rather than use the fluent API
  • Exposes the low level client if you need to perform requests with strings, byte arrays, anonymous types. Allows mixing and matching request/response types with more primitive types
  • Automatic failover and retry semantics
  • Intrinsic knowledge of valid responses for endpoints e.g. a 404 response for a document not found may still be considered a valid response
  • Observable helper methods for longer running operations e.g. BulkAll, ScrollAll, Reindex
  • Maintained by Elastic as an official client, with great contributions from the community (thank you!). Includes documentation that is built from source code to mitigate drift from source, and make it easier to constantly improve
  • Pluggable components e.g. IConnection, IRequestPipeline, IElasticsearchSerializer, etc.

这篇关于为什么要在C#中使用NEST客户端,而不通过弹性搜索JSON查询直接查询弹性搜索服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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