Skip to content

Can't provide aliases within an index create call #6778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
michael-budnik opened this issue Oct 17, 2022 · 2 comments · Fixed by #6786
Closed

Can't provide aliases within an index create call #6778

michael-budnik opened this issue Oct 17, 2022 · 2 comments · Fixed by #6786
Labels
8.x Relates to a 8.x client version
Milestone

Comments

@michael-budnik
Copy link

michael-budnik commented Oct 17, 2022

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:

  1. Run following request (vanilla setup):
var createIndexResponse = await _client.Indices.CreateAsync("ix", c => c
   .Aliases(a => a.Add("ix_alias", new Alias() { }))
  1. 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

@michael-budnik michael-budnik added the 8.x Relates to a 8.x client version label Oct 17, 2022
@michael-budnik michael-budnik changed the title Can't provide aliases with index create call. Can't provide aliases within an index create call Oct 17, 2022
@michael-budnik
Copy link
Author

Just checked and a dedicated PutAliasAsync works just fine

@stevejgordon stevejgordon added this to the 8.0.0 milestone Oct 17, 2022
@stevejgordon
Copy link
Contributor

Thanks for raising this @michael-budnik. I've got a related item on my snags list, and it should be a simple fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Relates to a 8.x client version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants