diff --git a/Directory.Packages.props b/Directory.Packages.props
index 8d280c875a..a00ac8f6df 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -51,8 +51,8 @@
-
-
+
+
diff --git a/src/Elastic.Documentation.ServiceDefaults/ElasticsearchEndpointFactory.cs b/src/Elastic.Documentation.ServiceDefaults/ElasticsearchEndpointFactory.cs
index 6d1bd7ba5c..c09c244193 100644
--- a/src/Elastic.Documentation.ServiceDefaults/ElasticsearchEndpointFactory.cs
+++ b/src/Elastic.Documentation.ServiceDefaults/ElasticsearchEndpointFactory.cs
@@ -7,13 +7,14 @@
namespace Elastic.Documentation.ServiceDefaults;
-/// Centralizes user-secrets + env-var reading for Elasticsearch configuration.
+/// Centralizes env-var + user-secrets reading for Elasticsearch configuration.
public static class ElasticsearchEndpointFactory
{
private const string UserSecretsId = "72f50f33-6fb9-4d08-bff3-39568fe370b3";
///
/// Creates from user secrets and environment variables.
+ /// Environment variables take priority over user secrets.
///
public static DocumentationEndpoints Create(IConfiguration? appConfiguration = null, string? buildType = null, string? environment = null)
{
@@ -23,20 +24,20 @@ public static DocumentationEndpoints Create(IConfiguration? appConfiguration = n
var config = configBuilder.Build();
var url =
- config["Parameters:DocumentationElasticUrl"]
- ?? config["DOCUMENTATION_ELASTIC_URL"];
+ config["DOCUMENTATION_ELASTIC_URL"]
+ ?? config["Parameters:DocumentationElasticUrl"];
var apiKey =
- config["Parameters:DocumentationElasticApiKey"]
- ?? config["DOCUMENTATION_ELASTIC_APIKEY"];
+ config["DOCUMENTATION_ELASTIC_APIKEY"]
+ ?? config["Parameters:DocumentationElasticApiKey"];
var password =
- config["Parameters:DocumentationElasticPassword"]
- ?? config["DOCUMENTATION_ELASTIC_PASSWORD"];
+ config["DOCUMENTATION_ELASTIC_PASSWORD"]
+ ?? config["Parameters:DocumentationElasticPassword"];
var username =
- config["Parameters:DocumentationElasticUsername"]
- ?? config["DOCUMENTATION_ELASTIC_USERNAME"]
+ config["DOCUMENTATION_ELASTIC_USERNAME"]
+ ?? config["Parameters:DocumentationElasticUsername"]
?? "elastic";
if (string.IsNullOrEmpty(url))
@@ -59,8 +60,8 @@ public static DocumentationEndpoints Create(IConfiguration? appConfiguration = n
buildType ??= appConfiguration?["DOCS_BUILD_TYPE"] ?? config["DOCS_BUILD_TYPE"] ?? "isolated";
var searchIndexOverride =
- config["Parameters:DocumentationElasticIndexOverride"]
- ?? config["DOCUMENTATION_ELASTIC_INDEX_OVERRIDE"];
+ config["DOCUMENTATION_ELASTIC_INDEX_OVERRIDE"]
+ ?? config["Parameters:DocumentationElasticIndexOverride"];
return new DocumentationEndpoints
{
@@ -84,6 +85,10 @@ private static string ResolveEnvironment(IConfiguration config, IConfiguration?
?? config["DOTNET_ENVIRONMENT"]
?? config["ENVIRONMENT"];
+ string[] allowedEnvironements = ["dev", "prod", "staging"];
+ if (!allowedEnvironements.Contains(envVar))
+ envVar = "dev";
+
return !string.IsNullOrEmpty(envVar) ? envVar.ToLowerInvariant() : "dev";
}
}
diff --git a/src/api/Elastic.Documentation.Mcp.Remote/appsettings.development.json b/src/api/Elastic.Documentation.Mcp.Remote/appsettings.development.json
index 34f00ef136..148200bc04 100644
--- a/src/api/Elastic.Documentation.Mcp.Remote/appsettings.development.json
+++ b/src/api/Elastic.Documentation.Mcp.Remote/appsettings.development.json
@@ -2,7 +2,8 @@
"Logging": {
"LogLevel": {
"Default": "Debug",
- "Microsoft.AspNetCore": "Information"
+ "Microsoft.AspNetCore": "Information",
+ "OpenTelemetry": "Warning"
}
}
}
diff --git a/src/api/Elastic.Documentation.Mcp.Remote/appsettings.edge.json b/src/api/Elastic.Documentation.Mcp.Remote/appsettings.edge.json
index 0c208ae918..4afa71e152 100644
--- a/src/api/Elastic.Documentation.Mcp.Remote/appsettings.edge.json
+++ b/src/api/Elastic.Documentation.Mcp.Remote/appsettings.edge.json
@@ -2,7 +2,8 @@
"Logging": {
"LogLevel": {
"Default": "Information",
- "Microsoft.AspNetCore": "Warning"
+ "Microsoft.AspNetCore": "Warning",
+ "OpenTelemetry": "Warning"
}
}
}
diff --git a/src/api/Elastic.Documentation.Mcp.Remote/appsettings.json b/src/api/Elastic.Documentation.Mcp.Remote/appsettings.json
index 10f68b8c8b..9e7dcb3c2e 100644
--- a/src/api/Elastic.Documentation.Mcp.Remote/appsettings.json
+++ b/src/api/Elastic.Documentation.Mcp.Remote/appsettings.json
@@ -2,7 +2,8 @@
"Logging": {
"LogLevel": {
"Default": "Information",
- "Microsoft.AspNetCore": "Warning"
+ "Microsoft.AspNetCore": "Warning",
+ "OpenTelemetry": "Warning"
}
},
"AllowedHosts": "*"
diff --git a/src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientAccessor.cs b/src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientAccessor.cs
index b06d06166d..35b3829d30 100644
--- a/src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientAccessor.cs
+++ b/src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientAccessor.cs
@@ -68,8 +68,9 @@ SearchConfiguration searchConfiguration
_nodePool,
sourceSerializer: (_, settings) => new DefaultSourceSerializer(
settings,
- ElasticsearchClientJsonResolver.Default,
- static jsonOptions => jsonOptions.Converters.Add(RuleQueryMatchCriteriaJsonConverterFactory.Instance)))
+ ElasticsearchClientJsonResolver.Default
+ )
+ )
.DefaultIndex(SearchIndex)
.Authentication(auth);
diff --git a/src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientJsonResolver.cs b/src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientJsonResolver.cs
index 95fb70d1c0..184371dbb9 100644
--- a/src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientJsonResolver.cs
+++ b/src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientJsonResolver.cs
@@ -16,12 +16,10 @@ internal static class ElasticsearchClientJsonResolver
{
public static IJsonTypeInfoResolver Default { get; } = Create();
- private static IJsonTypeInfoResolver Create()
- {
- var combined = JsonTypeInfoResolver.Combine(
+ private static IJsonTypeInfoResolver Create() =>
+ JsonTypeInfoResolver.Combine(
InternalSearch.SourceGenerationContext.Default,
- SourceGenerationContext.Default);
-
- return new RuleQueryMatchCriteriaTypeInfoResolver(combined);
- }
+ InternalSearch.Elasticsearch.SourceGenerationContext.Default,
+ SourceGenerationContext.Default
+ );
}
diff --git a/src/services/search/Elastic.Documentation.Search/Common/RuleQueryMatchCriteriaJsonConverter.cs b/src/services/search/Elastic.Documentation.Search/Common/RuleQueryMatchCriteriaJsonConverter.cs
deleted file mode 100644
index eb34abae94..0000000000
--- a/src/services/search/Elastic.Documentation.Search/Common/RuleQueryMatchCriteriaJsonConverter.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-// Licensed to Elasticsearch B.V under one or more agreements.
-// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
-// See the LICENSE file in the project root for more information
-
-using System.Diagnostics.CodeAnalysis;
-using System.Reflection;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-
-namespace Elastic.Documentation.Search.Common;
-
-///
-/// Serializes Elastic.Internal.Search.Elasticsearch.RuleQueryMatchCriteria, which is internal to the
-/// Elasticsearch search package and therefore not covered by public types.
-///
-internal sealed class RuleQueryMatchCriteriaJsonConverterFactory : JsonConverterFactory
-{
- public static readonly RuleQueryMatchCriteriaJsonConverterFactory Instance = new();
-
- [DynamicDependency(
- DynamicallyAccessedMemberTypes.All,
- "Elastic.Internal.Search.Elasticsearch.RuleQueryMatchCriteria",
- "Elastic.Internal.Search.Elasticsearch")]
- private static readonly Type RuleQueryMatchCriteriaType = Type.GetType(
- "Elastic.Internal.Search.Elasticsearch.RuleQueryMatchCriteria, Elastic.Internal.Search.Elasticsearch",
- throwOnError: true)!;
-
- public override bool CanConvert(Type typeToConvert) => typeToConvert == RuleQueryMatchCriteriaType;
-
- public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) =>
- RuleQueryMatchCriteriaJsonConverter.Instance;
-}
-
-internal sealed class RuleQueryMatchCriteriaJsonConverter : JsonConverter