Skip to content

ElasticsearchClient.GetScript is broken #7729

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
erik-kallen opened this issue May 15, 2023 · 2 comments · Fixed by #7737
Closed

ElasticsearchClient.GetScript is broken #7729

erik-kallen opened this issue May 15, 2023 · 2 comments · Fixed by #7737
Labels
8.x Relates to a 8.x client version
Milestone

Comments

@erik-kallen
Copy link

erik-kallen commented May 15, 2023

Elastic.Clients.Elasticsearch version: 8.1.0

Elasticsearch version: 8.5.2

.NET runtime version: Framework 4.7.2

Operating system version:

Description of the problem including expected versus actual behavior:

ElasticsearchClient.GetScript seems to alwyas throw an exception

Steps to reproduce:

Run this code

// This call returns successfully
var response = _elasticsearchClient.PutScript("my-script", s => s
    .Script(a => a
        .Language(ScriptLanguage.Painless)
        .Source("doc['id'].value")
    )
);

// This call throws
var script = _elasticsearchClient.GetScript(new GetScriptRequest("my-script"));

Expected behavior: Successful completion of GetScript

Actual behavior: This exception

Unhandled Exception: Elastic.Transport.UnexpectedTransportException: Constructor on type 'Elastic.Clients.Elasticsearch.ScriptLanguage' not found. ---> System.MissingMethodException: Constructor on type 'Elastic.Clients.Elasticsearch.ScriptLanguage' not found.
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
   at Elastic.Clients.Elasticsearch.Serialization.EnumStructConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) in /_/src/Elastic.Clients.Elasticsearch/Serialization/EnumStructConverter.cs:line 18
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)
   at System.Text.Json.JsonSerializer.ContinueDeserialize[TValue](ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack, JsonConverter converter, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.ReadAll[TValue](Stream utf8Json, JsonTypeInfo jsonTypeInfo)
   at System.Text.Json.JsonSerializer.ReadAllUsingOptions[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](Stream utf8Json, JsonSerializerOptions options)
   at Elastic.Clients.Elasticsearch.Serialization.SystemTextJsonSerializer.Deserialize[T](Stream stream) in /_/src/Elastic.Clients.Elasticsearch/Serialization/SystemTextJsonSerializer.cs:line 67
   at Elastic.Transport.DefaultResponseBuilder`1.SetBody[TResponse](ApiCallDetails details, RequestData requestData, Stream responseStream, String mimeType) in /home/runner/work/elastic-transport-net/elastic-transport-net/src/Elastic.Transport/Components/Pipeline/DefaultResponseBuilder.cs:line 193
   at Elastic.Transport.DefaultResponseBuilder`1.ToResponse[TResponse](RequestData requestData, Exception ex, Nullable`1 statusCode, Dictionary`2 headers, Stream responseStream, String mimeType, Int64 contentLength, IReadOnlyDictionary`2 threadPoolStats, IReadOnlyDictionary`2 tcpStats) in /home/runner/work/e
lastic-transport-net/elastic-transport-net/src/Elastic.Transport/Components/Pipeline/DefaultResponseBuilder.cs:line 61
   at Elastic.Transport.HttpWebRequestTransportClient.Request[TResponse](RequestData requestData) in /home/runner/work/elastic-transport-net/elastic-transport-net/src/Elastic.Transport/Components/TransportClient/HttpWebRequestTransportClient.cs:line 103
   at Elastic.Transport.DefaultRequestPipeline`1.CallProductEndpoint[TResponse](RequestData requestData) in /home/runner/work/elastic-transport-net/elastic-transport-net/src/Elastic.Transport/Components/Pipeline/DefaultRequestPipeline.cs:line 219
   at Elastic.Transport.DefaultHttpTransport`1.Request[TResponse](HttpMethod method, String path, PostData data, RequestParameters requestParameters) in /home/runner/work/elastic-transport-net/elastic-transport-net/src/Elastic.Transport/DefaultHttpTransport.cs:line 164
   --- End of inner exception stack trace ---
   at Elastic.Transport.DefaultHttpTransport`1.ThrowUnexpectedTransportException[TResponse](Exception killerException, List`1 seenExceptions, RequestData requestData, TResponse response, RequestPipeline pipeline) in /home/runner/work/elastic-transport-net/elastic-transport-net/src/Elastic.Transport/DefaultHt
tpTransport.cs:line 328
   at Elastic.Transport.DefaultHttpTransport`1.Request[TResponse](HttpMethod method, String path, PostData data, RequestParameters requestParameters) in /home/runner/work/elastic-transport-net/elastic-transport-net/src/Elastic.Transport/DefaultHttpTransport.cs:line 177
   at Elastic.Clients.Elasticsearch.ElasticsearchClient.DoRequest[TRequest,TResponse,TRequestParameters](TRequest request, Action`1 forceConfiguration) in /_/src/Elastic.Clients.Elasticsearch/Client/ElasticsearchClient.cs:line 217
   at Elastic.Clients.Elasticsearch.ElasticsearchClient.GetScript(GetScriptRequest request) in /_/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs:line 1985
@erik-kallen erik-kallen added the 8.x Relates to a 8.x client version label May 15, 2023
@erik-kallen
Copy link
Author

No, I did not forget that. I just redacted some things when created the issue and I made a typo here

@stevejgordon stevejgordon added this to the 8.1.2 milestone May 15, 2023
@stevejgordon
Copy link
Contributor

Thanks for raising this, @erik-kallen. I see the issue here. Our converter has a bug, and we'll get this fixed in a patch release.

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