From 42793e03b01670e0c93b88bd7e267a6158a121eb Mon Sep 17 00:00:00 2001 From: Florian Bernd Date: Fri, 11 Oct 2024 16:01:25 +0200 Subject: [PATCH] Improve id inference (#8379) --- .../_Shared/Core/Infer/Id/IdResolver.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Id/IdResolver.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Id/IdResolver.cs index a52f871a209..70b07561a6f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Id/IdResolver.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Id/IdResolver.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Concurrent; +using System.Globalization; using System.Reflection; #if ELASTICSEARCH_SERVERLESS @@ -71,7 +72,7 @@ public string Resolve(Type type, object @object) cachedLookup = o => { var v = func(o); - return v?.ToString(); + return (v is IFormattable f) ? f.ToString(null, CultureInfo.InvariantCulture) : v?.ToString(); }; if (preferLocal) _localIdDelegates.TryAdd(type, cachedLookup);