Why use NEST client in C# and not directly query elastic search server through elastic search JSON query?

前端 未结 2 1155
感情败类
感情败类 2021-01-25 22:56

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

What is benefit of using NEST client and not directly putting JSON e

2条回答
  •  北海茫月
    2021-01-25 23:34

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

    • 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.

提交回复
热议问题