diff --git a/src/Elastic.Clients.Elasticsearch/Types/Mapping/Properties.cs b/src/Elastic.Clients.Elasticsearch/Types/Mapping/Properties.cs index 1f224c043b0..5a96b4c05e1 100644 --- a/src/Elastic.Clients.Elasticsearch/Types/Mapping/Properties.cs +++ b/src/Elastic.Clients.Elasticsearch/Types/Mapping/Properties.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; @@ -20,18 +19,6 @@ public partial class Properties public void Add(Expression> propertyName, IProperty property) => BackingDictionary.Add(Sanitize(propertyName), property); - public bool TryGetProperty(PropertyName propertyName, [NotNullWhen(returnValue: true)] out T? property) where T : class, IProperty - { - if (BackingDictionary.TryGetValue(propertyName, out var matchedProperty) && matchedProperty is T finalProperty) - { - property = finalProperty; - return true; - } - - property = null; - return false; - } - protected override PropertyName Sanitize(PropertyName key) => _settings?.Inferrer.PropertyName(key) ?? key; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzers.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzers.g.cs index 0a10b13c868..cdca9e70c71 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzers.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzers.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; @@ -37,6 +38,19 @@ public Analyzers(IDictionary container) : base(container) } public void Add(string name, IAnalyzer analyzer) => BackingDictionary.Add(Sanitize(name), analyzer); + public bool TryGetAnalyzer(string name, [NotNullWhen(returnValue: true)] out IAnalyzer analyzer) => BackingDictionary.TryGetValue(name, out analyzer); + public bool TryGetAnalyzer(string name, [NotNullWhen(returnValue: true)] out T? analyzer) + where T : class, IAnalyzer + { + if (BackingDictionary.TryGetValue(name, out var matchedValue) && matchedValue is T finalValue) + { + analyzer = finalValue; + return true; + } + + analyzer = null; + return false; + } } public sealed partial class AnalyzersDescriptor : IsADictionaryDescriptor diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharFilterDefinitions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharFilterDefinitions.g.cs index 999a81a7e02..08164fbb0b3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharFilterDefinitions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharFilterDefinitions.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; @@ -37,6 +38,19 @@ public CharFilterDefinitions(IDictionary containe } public void Add(string name, ICharFilterDefinition charFilterDefinition) => BackingDictionary.Add(Sanitize(name), charFilterDefinition); + public bool TryGetCharFilterDefinition(string name, [NotNullWhen(returnValue: true)] out ICharFilterDefinition charFilterDefinition) => BackingDictionary.TryGetValue(name, out charFilterDefinition); + public bool TryGetCharFilterDefinition(string name, [NotNullWhen(returnValue: true)] out T? charFilterDefinition) + where T : class, ICharFilterDefinition + { + if (BackingDictionary.TryGetValue(name, out var matchedValue) && matchedValue is T finalValue) + { + charFilterDefinition = finalValue; + return true; + } + + charFilterDefinition = null; + return false; + } } public sealed partial class CharFilterDefinitionsDescriptor : IsADictionaryDescriptor diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizers.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizers.g.cs index ec19e459a3c..3fdae6339b8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizers.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizers.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; @@ -37,6 +38,19 @@ public Normalizers(IDictionary container) : base(container) } public void Add(string name, INormalizer normalizer) => BackingDictionary.Add(Sanitize(name), normalizer); + public bool TryGetNormalizer(string name, [NotNullWhen(returnValue: true)] out INormalizer normalizer) => BackingDictionary.TryGetValue(name, out normalizer); + public bool TryGetNormalizer(string name, [NotNullWhen(returnValue: true)] out T? normalizer) + where T : class, INormalizer + { + if (BackingDictionary.TryGetValue(name, out var matchedValue) && matchedValue is T finalValue) + { + normalizer = finalValue; + return true; + } + + normalizer = null; + return false; + } } public sealed partial class NormalizersDescriptor : IsADictionaryDescriptor diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenFilterDefinitions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenFilterDefinitions.g.cs index 3be6bba9d2e..b8c89cce422 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenFilterDefinitions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenFilterDefinitions.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; @@ -37,6 +38,19 @@ public TokenFilterDefinitions(IDictionary contai } public void Add(string name, ITokenFilterDefinition tokenFilterDefinition) => BackingDictionary.Add(Sanitize(name), tokenFilterDefinition); + public bool TryGetTokenFilterDefinition(string name, [NotNullWhen(returnValue: true)] out ITokenFilterDefinition tokenFilterDefinition) => BackingDictionary.TryGetValue(name, out tokenFilterDefinition); + public bool TryGetTokenFilterDefinition(string name, [NotNullWhen(returnValue: true)] out T? tokenFilterDefinition) + where T : class, ITokenFilterDefinition + { + if (BackingDictionary.TryGetValue(name, out var matchedValue) && matchedValue is T finalValue) + { + tokenFilterDefinition = finalValue; + return true; + } + + tokenFilterDefinition = null; + return false; + } } public sealed partial class TokenFilterDefinitionsDescriptor : IsADictionaryDescriptor diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenizerDefinitions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenizerDefinitions.g.cs index 36d142e5ce1..02680ce6c7e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenizerDefinitions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenizerDefinitions.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; @@ -37,6 +38,19 @@ public TokenizerDefinitions(IDictionary container) } public void Add(string name, ITokenizerDefinition tokenizerDefinition) => BackingDictionary.Add(Sanitize(name), tokenizerDefinition); + public bool TryGetTokenizerDefinition(string name, [NotNullWhen(returnValue: true)] out ITokenizerDefinition tokenizerDefinition) => BackingDictionary.TryGetValue(name, out tokenizerDefinition); + public bool TryGetTokenizerDefinition(string name, [NotNullWhen(returnValue: true)] out T? tokenizerDefinition) + where T : class, ITokenizerDefinition + { + if (BackingDictionary.TryGetValue(name, out var matchedValue) && matchedValue is T finalValue) + { + tokenizerDefinition = finalValue; + return true; + } + + tokenizerDefinition = null; + return false; + } } public sealed partial class TokenizerDefinitionsDescriptor : IsADictionaryDescriptor diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Properties.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Properties.g.cs index 8939caf0b9f..f65dfb8a279 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Properties.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Properties.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; @@ -37,6 +38,19 @@ public Properties(IDictionary container) : base(contain } public void Add(PropertyName propertyName, IProperty property) => BackingDictionary.Add(Sanitize(propertyName), property); + public bool TryGetProperty(PropertyName propertyName, [NotNullWhen(returnValue: true)] out IProperty property) => BackingDictionary.TryGetValue(propertyName, out property); + public bool TryGetProperty(PropertyName propertyName, [NotNullWhen(returnValue: true)] out T? property) + where T : class, IProperty + { + if (BackingDictionary.TryGetValue(propertyName, out var matchedValue) && matchedValue is T finalValue) + { + property = finalValue; + return true; + } + + property = null; + return false; + } } public sealed partial class PropertiesDescriptor : IsADictionaryDescriptor, Properties, PropertyName, IProperty>