Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Nest/DSL/Paths/DocumentOptionalPathDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void SetRouteParameters<TParameters>(
ElasticsearchPathInfo<TParameters> pathInfo)
where TParameters : IRequestParameters, new()
{
var inferrer = new ElasticInferrer(settings);
var inferrer = settings.Inferrer;

pathInfo.Index = inferrer.IndexName(path.Index);
pathInfo.Type = inferrer.TypeName(path.Type);
Expand All @@ -45,7 +45,7 @@ public static void SetRouteParameters<TParameters, T>(
where TParameters : IRequestParameters, new()
where T : class
{
var inferrer = new ElasticInferrer(settings);
var inferrer = settings.Inferrer;

var index = path.Index != null ? inferrer.IndexName(path.Index) : inferrer.IndexName<T>();
var type = path.Type != null ? inferrer.TypeName(path.Type) : inferrer.TypeName<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Nest/DSL/Paths/FixedIndexTypePathDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static void SetRouteParameters<TParameters>(
ElasticsearchPathInfo<TParameters> pathInfo)
where TParameters : IRequestParameters, new()
{
var inferrer = new ElasticInferrer(settings);
var inferrer = settings.Inferrer;
var index = inferrer.IndexName(path.Index);
var type = inferrer.TypeName(path.Type);

Expand Down
2 changes: 1 addition & 1 deletion src/Nest/DSL/Visitor/DslPrettyPrintVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public string PrettyPrint
public DslPrettyPrintVisitor(IConnectionSettingsValues settings)
{
this._sb = new StringBuilder();
this._infer = new ElasticInferrer(settings);
this._infer = settings.Inferrer;
}

public virtual int Depth { get; set; }
Expand Down
4 changes: 4 additions & 0 deletions src/Nest/Domain/Connection/ConnectionSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ string IConnectionSettingsValues.DefaultIndex
}
}

private ElasticInferrer _inferrer;
ElasticInferrer IConnectionSettingsValues.Inferrer { get { return _inferrer; } }

private Func<Type, string> _defaultTypeNameInferrer;
Func<Type, string> IConnectionSettingsValues.DefaultTypeNameInferrer { get { return _defaultTypeNameInferrer; } }

Expand Down Expand Up @@ -97,6 +100,7 @@ public ConnectionSettings(IConnectionPool connectionPool, string defaultIndex) :

this._modifyJsonSerializerSettings = (j) => { };
this._contractConverters = Enumerable.Empty<Func<Type, JsonConverter>>().ToList().AsReadOnly();
this._inferrer = new ElasticInferrer(this);
}
public ConnectionSettings(Uri uri, string defaultIndex)
: this(new SingleNodeConnectionPool(uri ?? new Uri("http://localhost:9200")), defaultIndex)
Expand Down
1 change: 1 addition & 0 deletions src/Nest/Domain/Connection/IConnectionSettingsValues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Nest
{
public interface IConnectionSettingsValues : IConnectionConfigurationValues
{
ElasticInferrer Inferrer { get; }
FluentDictionary<Type, string> DefaultIndices { get; }
FluentDictionary<Type, string> DefaultTypeNames { get; }
string DefaultIndex { get; }
Expand Down
2 changes: 1 addition & 1 deletion src/Nest/Domain/Paths/FieldSelection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class FieldSelection<T> : IFieldSelection<T>
private ElasticInferrer Infer { get; set; }
public FieldSelection(IConnectionSettingsValues settings, IDictionary<string, object> valuesDictionary = null)
{
this.Infer = new ElasticInferrer(settings);
this.Infer = settings.Inferrer;
((IFieldSelection<T>)this).FieldValuesDictionary = valuesDictionary;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Nest/Domain/Responses/BaseResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public ElasticInferrer Infer
var settings = this.Settings;
if (settings == null)
return null;
this._infer = new ElasticInferrer(settings);
this._infer = this.Settings.Inferrer;
return this._infer;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Nest/ElasticClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public ElasticClient(
this.Serializer
);
this.RawDispatch = new RawDispatch(this.Raw);
this.Infer = new ElasticInferrer(this._connectionSettings);
this.Infer = this._connectionSettings.Inferrer;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public string PrettyPrint
public DslPrettyPrintVisitor(IConnectionSettingsValues settings)
{
this._sb = new StringBuilder();
this._infer = new ElasticInferrer(settings);
this._infer = settings.Inferrer;
}

public virtual int Depth { get; set; }
Expand Down