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
Description of the problem including expected versus actual behavior:
There is a missmatch between elasticsearch json and the client deserializer when creating an index with
settings - analysis - filter - custom_ascii_folding - preserve_original : true
Expected behavior: Add index and read index without error.
Actual behavior: Reading index will result in json parse exception
Steps to reproduce:
Add index with filter tokenfilter tf -> tf.AsciiFolding("custom_ascii_folding", e => e.PreserveOriginal(true));
Get Index - Indices.Get(new GetIndexRequest(Indices.All))
Exception occurs
Expected behavior
Elastic should serialize PreserveOriginal as bool ( "preserve_original": true )
or RequestResponseSerializer should be able to handle conversion from string "true" to bool.
Provide DebugInformation (if relevant):
Here is the GetIndex response from elastic 8.7.1: {"article-test-en-us":{"aliases":{},"mappings":{"properties":{"categories":{"type":"keyword"},"content":{"type":"text","index_options":"offsets","analyzer":"custom_html"},"defaultViewOriginContexts":{"type":"keyword"},"statistics":{"type":"nested","properties":{"popularity":{"type":"double"},"role":{"type":"keyword"},"viewOriginContext":{"type":"keyword"}}},"title":{"type":"text","index_options":"offsets","analyzer":"custom_html"}}},"settings":{"index":{"routing":{"allocation":{"include":{"_tier_preference":"data_content"}}},"number_of_shards":"1","provided_name":"article-test-en-us","creation_date":"1687162213728","analysis":**_{"filter":{"custom_ascii_folding":{"type":"asciifolding","preserve_original":"true"},_**"english_stemmer":{"type":"stemmer","language":"english"},"english_stop":{"type":"stop","stopwords":"_english_"}},"analyzer":{"custom_html":{"filter":["lowercase","custom_ascii_folding","english_stop","english_stemmer"],"char_filter":["custom_html_strip"],"type":"custom","tokenizer":"standard"}},"char_filter":{"custom_html_strip":{"type":"html_strip"}}},"number_of_replicas":"1","uuid":"Zzyhj9S9QfeLBgozuC0H3A","version":{"created":"8070199"}}}}}
RequestResponseSerializer.Deserialize()
System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable1[System.Boolean]. Path: $.preserve_original | LineNumber: 2 | BytePositionInLine: 42. ---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a boolean.`
This looks like a spec issue which needs to be addressed to support these properties potentially being returned as strings rather than raw boolean values.
Elastic.Clients.Elasticsearch version: 8.1.1
Elasticsearch version: 8.7.1
.NET runtime version: 4.8
Operating system version: Windows 11
Description of the problem including expected versus actual behavior:
There is a missmatch between elasticsearch json and the client deserializer when creating an index with
settings - analysis - filter - custom_ascii_folding - preserve_original : true
Expected behavior: Add index and read index without error.
Actual behavior: Reading index will result in json parse exception
Steps to reproduce:
Expected behavior
Elastic should serialize PreserveOriginal as bool ( "preserve_original": true )
or RequestResponseSerializer should be able to handle conversion from string "true" to bool.
Provide
DebugInformation
(if relevant):Here is the GetIndex response from elastic 8.7.1:
{"article-test-en-us":{"aliases":{},"mappings":{"properties":{"categories":{"type":"keyword"},"content":{"type":"text","index_options":"offsets","analyzer":"custom_html"},"defaultViewOriginContexts":{"type":"keyword"},"statistics":{"type":"nested","properties":{"popularity":{"type":"double"},"role":{"type":"keyword"},"viewOriginContext":{"type":"keyword"}}},"title":{"type":"text","index_options":"offsets","analyzer":"custom_html"}}},"settings":{"index":{"routing":{"allocation":{"include":{"_tier_preference":"data_content"}}},"number_of_shards":"1","provided_name":"article-test-en-us","creation_date":"1687162213728","analysis":**_{"filter":{"custom_ascii_folding":{"type":"asciifolding","preserve_original":"true"},_**"english_stemmer":{"type":"stemmer","language":"english"},"english_stop":{"type":"stop","stopwords":"_english_"}},"analyzer":{"custom_html":{"filter":["lowercase","custom_ascii_folding","english_stop","english_stemmer"],"char_filter":["custom_html_strip"],"type":"custom","tokenizer":"standard"}},"char_filter":{"custom_html_strip":{"type":"html_strip"}}},"number_of_replicas":"1","uuid":"Zzyhj9S9QfeLBgozuC0H3A","version":{"created":"8070199"}}}}}
RequestResponseSerializer.Deserialize()
System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable
1[System.Boolean]. Path: $.preserve_original | LineNumber: 2 | BytePositionInLine: 42. ---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a boolean.`Stack Trace:
ThrowHelper.ThrowInvalidOperationException_ExpectedBoolean(JsonTokenType tokenType)
Utf8JsonReader.GetBoolean()
BooleanConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
NullableConverter
1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) JsonPropertyInfo
1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)ObjectDefaultConverter
1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) JsonConverter
1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)JsonConverter
1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) --- End of inner exception stack trace --- ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex) <35 more frames...> JsonSerializer.Deserialize[TValue](Utf8JsonReader& reader, JsonSerializerOptions options) ResolvableDictionaryResponseConverterInner
3.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) line 74JsonConverter
1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) JsonConverter
1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)JsonSerializer.ReadCore[TValue](Utf8JsonReader& reader, JsonTypeInfo jsonTypeInfo, ReadStack& state)
JsonSerializer.ContinueDeserialize[TValue](ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack, JsonTypeInfo jsonTypeInfo)
JsonSerializer.ReadFromStream[TValue](Stream utf8Json, JsonTypeInfo jsonTypeInfo)
JsonSerializer.Deserialize[TValue](Stream utf8Json, JsonSerializerOptions options)
The text was updated successfully, but these errors were encountered: