Closed
Description
Elastic.Clients.Elasticsearch version: beta-5
Elasticsearch version: 8.4.2
.NET runtime version: full 4.8
Operating system version: windows 10
Description of the problem including expected versus actual behavior:
Can't specify aliases within an index create call.
Steps to reproduce:
- Run following request (vanilla setup):
var createIndexResponse = await _client.Indices.CreateAsync("ix", c => c
.Aliases(a => a.Add("ix_alias", new Alias() { }))
- Observe exception:
Elastic.Transport.UnexpectedTransportException : The type 'Elastic.Clients.Elasticsearch.Name' is not a supported dictionary key using converter of type 'Elastic.Clients.Elasticsearch.StringAliasConverter`1[Elastic.Clients.Elasticsearch.Name]'. The unsupported member type is located on type 'Elastic.Clients.Elasticsearch.IndexManagement.Alias'. Path: $.
Call stack:
JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
JsonSerializer.WriteUsingSerializer[TValue](Utf8JsonWriter writer, TValue& value, JsonTypeInfo jsonTypeInfo)
JsonSerializer.Serialize[TValue](Utf8JsonWriter writer, TValue value, JsonSerializerOptions options)
CreateRequestDescriptor.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) line 339
ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) line 156
SelfSerializableJsonConverter.Write(Utf8JsonWriter writer, ISelfSerializable value, JsonSerializerOptions options) line 35
JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
JsonConverter`1.WriteCoreAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state)
JsonSerializer.WriteCore[TValue](JsonConverter jsonConverter, Utf8JsonWriter writer, TValue& value, JsonSerializerOptions options, WriteStack& state)
<WriteStreamAsync>d__112`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
ExceptionDispatchInfo.Throw()
<WriteStreamAsync>d__112`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
ExceptionDispatchInfo.Throw()
<WriteStreamAsync>d__112`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
TaskAwaiter.ThrowForNonSuccess(Task task)
TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
<WriteAsync>d__4.MoveNext() line 53
--- End of stack trace from previous location where exception was thrown ---
TaskAwaiter.ThrowForNonSuccess(Task task)
TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
TaskAwaiter.ValidateEnd(Task task)
<RequestAsync>d__6`1.MoveNext() line 149
--- End of stack trace from previous location where exception was thrown ---
TaskAwaiter.ThrowForNonSuccess(Task task)
TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
<CallProductEndpointAsync>d__55`1.MoveNext() line 234
--- End of stack trace from previous location where exception was thrown ---
TaskAwaiter.ThrowForNonSuccess(Task task)
TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
TaskAwaiter.ValidateEnd(Task task)
<RequestAsync>d__17`1.MoveNext() line 263
--NotSupportedException
ThrowHelper.ThrowNotSupportedException_DictionaryKeyTypeNotSupported(Type keyType, JsonConverter converter)
JsonConverter`1.WriteAsPropertyName(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
JsonConverter`1.WriteAsPropertyNameCore(Utf8JsonWriter writer, T value, JsonSerializerOptions options, Boolean isWritingExtensionDataProperty)
DictionaryOfTKeyTValueConverter`3.OnWriteResume(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
JsonDictionaryConverter`3.OnTryWrite(Utf8JsonWriter writer, TDictionary dictionary, JsonSerializerOptions options, WriteStack& state)
JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
Expected behavior
It should be able to provide aliases within an index create request