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);