Skip to content

Commit fe3105d

Browse files
committed
Reverting index name validation
Closes #1017
1 parent d1bc20d commit fe3105d

File tree

4 files changed

+0
-99
lines changed

4 files changed

+0
-99
lines changed

src/Nest/DSL/CreateIndexDescriptor.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,10 @@ public interface ICreateIndexRequest : IIndexPath<CreateIndexRequestParameters>
1717

1818
internal static class CreateIndexPathInfo
1919
{
20-
private static char[] _invalidChars = new[] { '\\', '/', '*', '?', '"', '<', '>', '|', ' ', ',', '#' };
21-
private static string _invalidCharsMessage = string.Join(", ", _invalidChars);
22-
2320
public static void Update(ElasticsearchPathInfo<CreateIndexRequestParameters> pathInfo, ICreateIndexRequest request)
2421
{
2522
pathInfo.HttpMethod = PathInfoHttpMethod.POST;
2623
}
27-
28-
public static void Validate(ElasticsearchPathInfo<CreateIndexRequestParameters> pathInfo, ICreateIndexRequest request)
29-
{
30-
var index = pathInfo.Index;
31-
if (index.StartsWith("_"))
32-
throw new DslException("indexname {0} may not start with an underscore".F(index));
33-
34-
if (Encoding.UTF8.GetByteCount(index) > 255)
35-
throw new DslException("indexname {0} exceeds maximum index name length of 255".F(index));
36-
37-
if (index.Any(char.IsUpper))
38-
throw new DslException("indexname {0} contains uppercase characters".F(index));
39-
40-
if (index.Any(c => _invalidChars.Contains(c)))
41-
throw new DslException("indexname {0} contains one of {1} invalid characters".F(index, _invalidCharsMessage));
42-
43-
}
4424
}
4525

4626
public partial class CreateIndexRequest : IndexPathBase<CreateIndexRequestParameters>, ICreateIndexRequest
@@ -53,11 +33,6 @@ protected override void UpdatePathInfo(IConnectionSettingsValues settings, Elast
5333
{
5434
CreateIndexPathInfo.Update(pathInfo, this);
5535
}
56-
57-
protected override void ValidatePathInfo(ElasticsearchPathInfo<CreateIndexRequestParameters> pathInfo)
58-
{
59-
CreateIndexPathInfo.Validate(pathInfo, this);
60-
}
6136
}
6237

6338
[DescriptorFor("IndicesCreate")]
@@ -259,11 +234,5 @@ protected override void UpdatePathInfo(IConnectionSettingsValues settings, Elast
259234
{
260235
CreateIndexPathInfo.Update(pathInfo, this);
261236
}
262-
263-
protected override void ValidatePathInfo(ElasticsearchPathInfo<CreateIndexRequestParameters> pathInfo)
264-
{
265-
CreateIndexPathInfo.Validate(pathInfo, this);
266-
}
267-
268237
}
269238
}

src/Nest/Extensions/Extensions.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,6 @@ internal static void ThrowIfEmpty<T>(this IEnumerable<T> @object, string paramet
7575
throw new ArgumentException("Argument can not be an empty collection", parameterName);
7676
}
7777

78-
internal static void ThrownIfNotLowercase(this string @object, string parameterName)
79-
{
80-
@object.ThrowIfNull(parameterName);
81-
if (@object.Any(char.IsUpper))
82-
throw new ArgumentException("Argument can not have uppercase letter", parameterName);
83-
}
84-
8578
internal static IList<T> EagerConcat<T>(this IEnumerable<T> list, IEnumerable<T> other)
8679
{
8780
list = list.HasAny() ? list : Enumerable.Empty<T>();

src/Tests/Nest.Tests.Unit/Internals/Inferno/IndexNameResolverTests.cs

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

src/Tests/Nest.Tests.Unit/Nest.Tests.Unit.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@
243243
<Compile Include="Internals\Inferno\EscapedFormatTests.cs" />
244244
<Compile Include="Internals\Inferno\HostNameWithPathTests.cs" />
245245
<Compile Include="Internals\Inferno\MapTypeNamesTests.cs" />
246-
<Compile Include="Internals\Inferno\IndexNameResolverTests.cs" />
247246
<Compile Include="Internals\Inferno\MapPropertyNamesForTests.cs" />
248247
<Compile Include="Internals\Serialize\ConnectionSettingsTests.cs" />
249248
<Compile Include="Internals\Serialize\NullValueHandlingTests.cs" />

0 commit comments

Comments
 (0)