You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have metadata-like dictionary, which maps document type to its index name.
It maps greatly on DefaultIndeces property of ConnectionSettings class.
Since I always work with strongly-typed API, there is no need for me to set global DefaultIndex property at all.
I can always get index name from metadata dictionary
You will see that GetIndexForType method always touches DefaultIndex property, and touching this propery throws an exception "No default index set on connection!" if I not set it.
If it is will not get any troubles, can this part of code be rewritten without touching DefaultIndex property if DefaultIndices already contains index name?
Something like this:
public string GetIndexForType(Type type)
{
var defaultIndices = this._connectionSettings.DefaultIndices;
if (defaultIndices != null && defaultIndices.ContainsKey(type) && !string.IsNullOrWhiteSpace(defaultIndices[type]))
{
return defaultIndices[type]
}
return this._connectionSettings.DefaultIndex;
}
Sorry for issue instead of pull request.
The text was updated successfully, but these errors were encountered:
Hi.
I have metadata-like dictionary, which maps document type to its index name.
It maps greatly on DefaultIndeces property of ConnectionSettings class.
Since I always work with strongly-typed API, there is no need for me to set global DefaultIndex property at all.
I can always get index name from metadata dictionary
But If you take a look at
https://github.com/Mpdreamz/NEST/blob/master/src/Nest/Resolvers/IndexNameResolver.cs
You will see that GetIndexForType method always touches DefaultIndex property, and touching this propery throws an exception "No default index set on connection!" if I not set it.
If it is will not get any troubles, can this part of code be rewritten without touching DefaultIndex property if DefaultIndices already contains index name?
Something like this:
Sorry for issue instead of pull request.
The text was updated successfully, but these errors were encountered: