Skip to content

Commit 02e509b

Browse files
committed
Merge branch 'master' of github.com:elastic/elasticsearch-net
2 parents f07b8ea + 68166c3 commit 02e509b

File tree

25 files changed

+132
-62
lines changed

25 files changed

+132
-62
lines changed

src/Elasticsearch.Net/Configuration/ConnectionConfiguration.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ public abstract class ConnectionConfiguration<T> : IConnectionConfigurationValue
123123
private bool _throwExceptions;
124124
bool IConnectionConfigurationValues.ThrowExceptions => _throwExceptions;
125125

126-
private static void DefaultApiCallHandler(IApiCallDetails status) { }
127-
Action<IApiCallDetails> _apiCallHandler = DefaultApiCallHandler;
128-
Action<IApiCallDetails> IConnectionConfigurationValues.ApiCallHandler => _apiCallHandler;
126+
private static void DefaultCompletedRequestHandler(IApiCallDetails response) { }
127+
Action<IApiCallDetails> _completedRequestHandler = DefaultCompletedRequestHandler;
128+
Action<IApiCallDetails> IConnectionConfigurationValues.OnRequestCompleted => _completedRequestHandler;
129129

130130
private readonly NameValueCollection _queryString = new NameValueCollection();
131131
NameValueCollection IConnectionConfigurationValues.QueryStringParameters => _queryString;
@@ -290,10 +290,10 @@ public T PrettyJson(bool b = true) => Assign(a =>
290290

291291
/// <summary>
292292
/// Global callback for every response that NEST receives, useful for custom logging.
293-
/// Calling this multiple times will register multiple listeners
293+
/// Calling this multiple times will register multiple listeners.
294294
/// </summary>
295-
public T ConnectionStatusHandler(Action<IApiCallDetails> handler) =>
296-
Assign(a => a._apiCallHandler += handler ?? DefaultApiCallHandler);
295+
public T OnRequestCompleted(Action<IApiCallDetails> handler) =>
296+
Assign(a => a._completedRequestHandler += handler ?? DefaultCompletedRequestHandler);
297297

298298
/// <summary>
299299
/// Basic access authentication credentials to specify with all requests.

src/Elasticsearch.Net/Configuration/IConnectionConfigurationValues.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public interface IConnectionConfigurationValues : IDisposable
131131
/// <summary>
132132
/// Allows you to register a callback every time a an API call is returned
133133
/// </summary>
134-
Action<IApiCallDetails> ApiCallHandler { get; }
134+
Action<IApiCallDetails> OnRequestCompleted { get; }
135135

136136
/// <summary>
137137
/// Basic access authorization credentials to specify with all requests.

src/Elasticsearch.Net/Transport/Transport.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ public ElasticsearchResponse<TReturn> Request<TReturn>(HttpMethod method, string
100100
}
101101
if (response == null || !response.Success)
102102
pipeline.BadResponse(ref response, requestData, seenExceptions);
103+
104+
this.Settings.OnRequestCompleted?.Invoke(response);
105+
103106
return response;
104107
}
105108
}
@@ -157,6 +160,9 @@ public async Task<ElasticsearchResponse<TReturn>> RequestAsync<TReturn>(HttpMeth
157160
}
158161
if (response == null || !response.Success)
159162
pipeline.BadResponse(ref response, requestData, seenExceptions);
163+
164+
this.Settings.OnRequestCompleted?.Invoke(response);
165+
160166
return response;
161167
}
162168
}

src/Nest/Mapping/Norms/Norms.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using Newtonsoft.Json;
3+
using Newtonsoft.Json.Converters;
4+
5+
namespace Nest
6+
{
7+
[JsonObject(MemberSerialization.OptIn)]
8+
[JsonConverter(typeof(ReadAsTypeJsonConverter<Norms>))]
9+
public interface INorms
10+
{
11+
[JsonProperty("enabled")]
12+
bool? Enabled { get; set; }
13+
14+
[JsonProperty("loading")]
15+
[JsonConverter(typeof(StringEnumConverter))]
16+
NormsLoading? Loading { get; set; }
17+
}
18+
19+
public class Norms : INorms
20+
{
21+
public bool? Enabled { get; set; }
22+
public NormsLoading? Loading { get; set; }
23+
}
24+
25+
public class NormsDescriptor : DescriptorBase<NormsDescriptor, INorms>, INorms
26+
{
27+
bool? INorms.Enabled { get; set; }
28+
NormsLoading? INorms.Loading { get; set; }
29+
30+
public NormsDescriptor Enabled(bool enabled = true) => Assign(a => a.Enabled = enabled);
31+
public NormsDescriptor Loading(NormsLoading loading) => Assign(a => a.Loading = loading);
32+
}
33+
}

src/Nest/Mapping/Norms/NormsMapping.cs

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)