Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
478 lines (424 sloc) 13.7 KB

#Elasticsearch.Net breaking changes

This document rudimentally documents the breaking changes, our 2.0 refactor compromises 1000+ commits and nearly 6 months of work so if we missed anything feel free to give us a shout! (reply to this gist)

Dependency graph changes

The first thing you might notice is that the dependency graph for the client has changed slightly. It has also been renamed from IElasticsearchClient to ILowLevelElasticClient, to align better with the high level (NEST) client and better differentiate itself.

IElasticLowLevelClient
├─ITransport
├──IConnectionConfiguration
├───IConnectionPool
├───IConnection
└───Func<IConnectionConfiguration, IElasticsearchSerializer>

a client can still be new'ed with no arguments

new ElasticLowLevelClient();

Wich will default to a SingleNodeConnectionPool talking to http://localhost:9200

The next most common overload of the constructor is the one taking ConnectionConfiguration

new ElasticLowLevelClient(connectionSettings);

There are many overloads to the constructor of ConnectionConfiguration that allow you to inject a custom connection or serializer factory if needed What they all have in common is that you have to specify an IConnectionPool implementation e.g

var pool = new StaticConnectionPool(nodes);
var settings = new ConnectionConfiguration(pool);
var client = new ElasticLowLevelClient(settings);

Another big change in Elasticsearch.NET 2.0 is that internally we deal with Node's and not Uri's. However nodes in the above example can be either an IEnumerable<Uri> or IEnumerable<Node>.

For the super advanced usecases a custom ITransport can be injected.

var pool = new StaticConnectionPool(nodes);
var settings = new ConnectionConfiguration(pool);
var transport = new Transport(pool);
var client = new ElasticLowLevelClient(pool);

This is what we call internally if you use the previous ElasticLowLevelClient constructor. Our implementation of ITransport can be injected with a custom IRequestPipelineFactory, IDateTimeProvider and IMemoryStreamFactory. Transport is in control of managing our request pipelining, asking connectionpools for other nodes to fall over to and marking nodes dead or alive.

Each individual moving part is further explained in the documentation

ConnectionSettings Changes

This lists the methods that have been renamed or removed on ConnectionConfiguration

class ConnectionConfiguration`1
-     method: EnableCompressedResponses
+     method: EnableHttpCompression
-     method: EnableMetrics
-     method: EnableTrace
-     method: ExposeRawResponse
+     method: DisableDirectStreaming
-     method: HttpPipeliningEnabled
+     method: EnableHttpPipelining
-     method: SetBasicAuthentication
+     method: BasicAuthentication
-     method: SetBasicAuthorization
+     method: BasicAuthentication
-     method: SetConnectionStatusHandler
+     method: OnRequestCompleted
-     method: SetConnectTimeout
-     method: SetDeadTimeout
+     method: DeadTimeout
-     method: SetGlobalQueryStringParameters
+     method: GlobalQueryStringParameters
-     method: SetMaxDeadTimeout
+     method: MaxDeadTimeout
-     method: SetMaximumAsyncConnections
-     method: SetMaxRetryTimeout
+     method: MaxRetryTimeout
-     method: SetPingTimeout
+     method: PingTimeout
-     method: SetProxy
+     method: Proxy
-     method: SetTimeout
+     method: RequestTimeout
-     method: ThrowOnElasticsearchServerExceptions
+     method: ThrowExceptions
-     method: UsePrettyRequests
+     method: PrettyJson
-     method: UsePrettyResponses
+     method: PrettyJson

The same goes for the values they are settings:

interface IConnectionConfigurationValues
-     prop: BasicAuthorizationCredentials
+     prop: BasicAuthenticationCredentials
-     prop: ConnectionStatusHandler
+     prop: OnRequestCompleted
-     prop: ConnectTimeout
-     prop: EnableCompressedResponses
+     prop: EnableHttpCompression
-     prop: KeepRawResponse
+     prop: DisableDirectStreaming
-     prop: MaximumAsyncConnections
-     prop: MetricsEnabled
-     prop: ThrowOnElasticsearchServerExceptions
+     prop: ThrowExceptions
-     prop: Timeout
+     prop: RequestTimeout
-     prop: TraceEnabled
-     prop: TraceWriter
-     prop: UsesPrettyRequests
+     prop: PrettyJson
-     prop: UsesPrettyResponses
+     prop: PrettyJson

IConnectionPool

The interface for IConnectionPool has been greatly simplified, its no longer in charge of mark nodes alive or dead

interface IConnectionPool
-     prop: AcceptsUpdates
+     prop: SupportsReseeding
-     method: GetNext
-     method: MarkAlive
-     method: MarkDead
-     method: UpdateNodeList
+     method: Reseed

IConnection

The connection interface has been stripped to the bare minimum it now only has a Request and RequestAsync method

interface IConnection
-     prop: AddressScheme
-     method: Delete
-     method: DeleteSync
-     method: Get
-     method: GetSync
-     method: Head
-     method: HeadSync
-     method: Post
-     method: PostSync
-     method: Put
-     method: PutSync
+     method: Request
+     method: RequestAsync

The methods take a RequestData a new state object that holds all the information to build the request.

#Renamed Types

This lists the types that have been renamed

- class AliasRequestParameters
+ class BulkAliasRequestParameters

- class BasicAuthorizationCredentials
+ class BasicAuthenticationCredentials

- class ClusterSettingsRequestParameters
+ class ClusterPutSettingsRequestParameters

- class DeleteTemplateRequestParameters
+ class DeleteSearchTemplateRequestParameters

- class DynamicDictionary
+ class DynamicResponse

- class GetTemplateRequestParameters
+ class GetSearchTemplateRequestParameters

- interface IElasticsearchResponse
+ interface IApiCallDetails

- interface IMemoryStreamProvider
+ interface IMemoryStreamFactory

- class IndicesExistsAliasRequestParameters
+ class AliasExistsRequestParameters

- class IndicesExistsTemplateRequestParameters
+ class IndexTemplateExistsRequestParameters

- class IndicesExistsTypeRequestParameters
+ class TypeExistsRequestParameters

- class IndicesPutAliasRequestParameters
+ class PutAliasRequestParameters

- class IndicesRecoveryRequestParameters
+ class RecoveryStatusRequestParameters

- class InfoRequestParameters
+ class RootNodeInfoRequestParameters

- interface IResponseWithRequestInformation
+ interface IBodyWithApiCallDetails

- class MemoryStreamProvider
+ class MemoryStreamFactory

- class MpercolateRequestParameters
+ class MultiPercolateRequestParameters

- class PutTemplateRequestParameters
+ class PutIndexTemplateRequestParameters

- class TemplateExistsRequestParameters
+ class IndexTemplateExistsRequestParameters

#Removed Types

This lists the removed types

- class AbortBenchmarkRequestParameters
- class CallMetrics
- class ConnectionException
- class DeleteMappingRequestParameters
- class ElasticsearchAuthenticationException
- class ElasticsearchAuthException
- class ElasticsearchAuthorizationException
- class ElasticsearchResponse
- class ElasticsearchServerError
- class ElasticsearchServerException
- class EndpointState
- class FlushRequestParametersObsoleteExtensions
- interface IConnectionConfiguration
- interface IConnectionConfiguration`1
- class IndicesDeleteAliasClientExtensions
- class IndicesDeleteAliasRequestParameters
- class IndicesExistsAliasClientExtensions
- class IndicesExistsTemplateClientExtensions
- class IndicesExistsTypeClientExtensions
- class IndicesGetFieldMappingClientExtensions
- class IndicesGetFieldMappingRequestParameters
- class IndicesPutAliasClientExtensions
- class IndicesRecoveryStatusClientExtensions
- class IndicesStatusRequestParameters
- interface IRequestTimings
- interface ITransport
- interface ITransportRequestState
- class ListBenchmarksRequestParameters
- class MaxRetryException
- class MoreLikeThisRequestParameters
- class MpercolateClientExtensions
- class NodesShutdownRequestParameters
- class PingException
- enum Replication
- class RequestMetrics
- class RequestParameters
- enum RequestType
- class Sniffer
- class SniffException
- class TermvectorRequestParameters
- class Transport
- enum TransportAddressScheme
- class TransportRequestState`1
- class UpdateSettingsRequestParameters

#Member Changes

This lists changes of class members that might bite you during the upgrade

class BulkRequestParameters
-     method: Replication
class ClearCacheRequestParameters
-     method: Filter
-     method: FilterCache
-     method: FilterKeys
-     method: Id
-     method: IdCache
-     method: QueryCache
class CountRequestParameters
-     method: Q
class DateTimeProvider
-     method: AliveTime
class DeleteByQueryRequestParameters
-     method: Consistency
-     method: Q
-     method: Replication
class DeleteRequestParameters
-     method: Replication
class ElasticLowLevelClient
-     method: AbortBenchmark
-     method: AbortBenchmarkAsync
-     method: Encoded
-     method: IndicesDeleteMapping
-     method: IndicesDeleteMappingAsync
-     method: IndicesStatus
-     method: IndicesStatusAsync
-     method: IndicesStatusForAll
-     method: IndicesStatusForAllAsync
-     method: ListBenchmarks
-     method: ListBenchmarksAsync
-     method: Mlt
-     method: MltAsync
-     method: MltGet
-     method: MltGetAsync
-     method: NodesShutdown
-     method: NodesShutdownAsync
-     method: NodesShutdownForAll
-     method: NodesShutdownForAllAsync
-     method: Termvector
+     method: Termvectors
-     method: TermvectorAsync
+     method: TermvectorsAsync
-     method: TermvectorGet
+     method: TermvectorsGet
-     method: TermvectorGetAsync
+     method: TermvectorsGetAsync
class ElasticsearchDefaultSerializer
-     method: Iterate
-     method: ReadStreamAsync
-     method: Stringify
class ElasticsearchResponse`1
-     prop: Metrics
-     prop: NumberOfRetries
-     prop: Request
-     prop: RequestMethod
-     prop: RequestUrl
-     prop: Response
-     prop: ResponseRaw
-     prop: Serializer
-     prop: Settings
class ExplainRequestParameters
-     method: EnableSource
-     method: Q
class FieldStatsRequestParameters
-     method: Fields
class FluentRequestParameters`1
-     method: CopyQueryStringValuesFrom
-     method: DeserializationState
class GetRequestParameters
-     method: EnableSource
class HttpConnection
-     prop: AddressScheme
-     method: Delete
-     method: DeleteSync
-     method: Get
-     method: GetSync
-     method: Head
-     method: HeadSync
-     method: Post
-     method: PostSync
-     method: Put
-     method: PutSync
interface IDateTimeProvider
-     method: AliveTime
interface IElasticLowLevelClient
-     method: AbortBenchmark
-     method: AbortBenchmarkAsync
-     method: Encoded
-     method: IndicesDeleteMapping
-     method: IndicesDeleteMappingAsync
-     method: IndicesStatus
-     method: IndicesStatusAsync
-     method: IndicesStatusForAll
-     method: IndicesStatusForAllAsync
-     method: ListBenchmarks
-     method: ListBenchmarksAsync
-     method: Mlt
-     method: MltAsync
-     method: MltGet
-     method: MltGetAsync
-     method: NodesShutdown
-     method: NodesShutdownAsync
-     method: NodesShutdownForAll
-     method: NodesShutdownForAllAsync
-     method: Termvector
+     method: Termvectors
-     method: TermvectorAsync
+     method: TermvectorsAsync
-     method: TermvectorGet
+     method: TermvectorsGet
-     method: TermvectorGetAsync
+     method: TermvectorsGetAsync
- interface IElasticsearchResponse
+ interface IApiCallDetails
-     prop: Metrics
-     prop: NumberOfRetries
-     prop: Request
-     prop: RequestMethod
-     prop: RequestUrl
-     prop: ResponseRaw
-     prop: Settings
interface IElasticsearchSerializer
-     method: Stringify
- interface IMemoryStreamProvider
+ interface IMemoryStreamFactory
-     method: New
class IndexRequestParameters
-     method: Replication
class InMemoryConnection
-     prop: AddressScheme
-     prop: RecordRequests
interface IRequestConfiguration
-     prop: BasicAuthorizationCredentials
+     prop: BasicAuthenticationCredentials
-     prop: ConnectTimeout
interface IRequestParameters
-     prop: DeserializationState
+     prop: DeserializationOverride
- interface IResponseWithRequestInformation
+ interface IBodyWithApiCallDetails
-     prop: RequestInformation
+     prop: CallDetails
- class MemoryStreamProvider
+ class MemoryStreamFactory
-     method: New
class MultiGetRequestParameters
-     method: EnableSource
class OptimizeRequestParameters
-     method: Force
class PutMappingRequestParameters
-     method: IgnoreConflicts
class RequestConfiguration
-     prop: BasicAuthorizationCredentials
+     prop: BasicAuthenticationCredentials
-     prop: ConnectTimeout
class RequestConfigurationDescriptor
-     method: BasicAuthorization
-     method: ConnectTimeout
class SearchExistsRequestParameters
-     method: Q
class SearchRequestParameters
-     method: QueryCache
class SingleNodeConnectionPool
-     prop: AcceptsUpdates
+     prop: SupportsReseeding
-     method: GetNext
-     method: MarkAlive
-     method: MarkDead
-     method: UpdateNodeList
+     method: Reseed
class SniffingConnectionPool
-     prop: AcceptsUpdates
+     prop: SupportsReseeding
-     method: GetNext
-     method: MarkAlive
-     method: MarkDead
-     method: UpdateNodeList
+     method: Reseed
class SourceRequestParameters
-     method: EnableSource
class StaticConnectionPool
-     prop: AcceptsUpdates
+     prop: SupportsReseeding
-     method: GetNext
-     method: MarkAlive
-     method: MarkDead
-     method: UpdateNodeList
+     method: Reseed
class UpdateRequestParameters
-     method: Replication
class ValidateQueryRequestParameters
-     method: Q
You can’t perform that action at this time.