diff --git a/src/Elastic.Documentation.Configuration/DocumentationEndpoints.cs b/src/Elastic.Documentation.Configuration/DocumentationEndpoints.cs index c9a0b9361..51a9797f0 100644 --- a/src/Elastic.Documentation.Configuration/DocumentationEndpoints.cs +++ b/src/Elastic.Documentation.Configuration/DocumentationEndpoints.cs @@ -23,6 +23,7 @@ public class ElasticsearchEndpoint // inference options public int SearchNumThreads { get; set; } = 8; public int IndexNumThreads { get; set; } = 8; + public bool NoElasticInferenceService { get; set; } // index options public string IndexNamePrefix { get; set; } = "semantic-docs"; @@ -31,7 +32,6 @@ public class ElasticsearchEndpoint public int BufferSize { get; set; } = 100; public int MaxRetries { get; set; } = 3; - // connection options public bool DebugMode { get; set; } public string? CertificateFingerprint { get; set; } diff --git a/src/Elastic.Markdown/Exporters/Elasticsearch/ElasticsearchExporter.cs b/src/Elastic.Markdown/Exporters/Elasticsearch/ElasticsearchExporter.cs index fd5bf68bf..3b8e42a23 100644 --- a/src/Elastic.Markdown/Exporters/Elasticsearch/ElasticsearchExporter.cs +++ b/src/Elastic.Markdown/Exporters/Elasticsearch/ElasticsearchExporter.cs @@ -56,7 +56,10 @@ DistributedTransport transport ActiveSearchAlias = $"{endpoint.IndexNamePrefix}-{indexNamespace.ToLowerInvariant()}", IndexNumThreads = endpoint.IndexNumThreads, SearchNumThreads = endpoint.SearchNumThreads, - InferenceCreateTimeout = TimeSpan.FromMinutes(endpoint.BootstrapTimeout ?? 4) + InferenceCreateTimeout = TimeSpan.FromMinutes(endpoint.BootstrapTimeout ?? 4), + UsePreexistingInferenceIds = !endpoint.NoElasticInferenceService, + InferenceId = endpoint.NoElasticInferenceService ? null : ".elser-2-elastic", + SearchInferenceId = endpoint.NoElasticInferenceService ? null : ".elser-2-elastic" }); @@ -250,15 +253,13 @@ protected static string CreateMapping(string? inferenceId) => private static string AbstractMapping() => """ - , "abstract": { - "type": "text" - } + , "abstract": { "type": "text" } """; - private static string InferenceMapping(string _) => + private static string InferenceMapping(string inferenceId) => $""" "type": "semantic_text", - "inference_id": ".elser-2-elastic" + "inference_id": "{inferenceId}" """; private static string AbstractInferenceMapping(string inferenceId) => diff --git a/src/services/Elastic.Documentation.Assembler/Indexing/AssemblerIndexService.cs b/src/services/Elastic.Documentation.Assembler/Indexing/AssemblerIndexService.cs index 363660069..5a1137c6f 100644 --- a/src/services/Elastic.Documentation.Assembler/Indexing/AssemblerIndexService.cs +++ b/src/services/Elastic.Documentation.Assembler/Indexing/AssemblerIndexService.cs @@ -36,6 +36,7 @@ ICoreService githubActionsService /// Index without semantic fields /// The number of search threads the inference endpoint should use. Defaults: 8 /// The number of index threads the inference endpoint should use. Defaults: 8 + /// Do not use the Elastic Inference Service, bootstrap inference endpoint /// Timeout in minutes for the inference endpoint creation. Defaults: 4 /// The prefix for the computed index/alias names. Defaults: semantic-docs /// Force reindex strategy to semantic index @@ -62,6 +63,7 @@ public async Task Index(IDiagnosticsCollector collector, bool? noSemantic = null, int? searchNumThreads = null, int? indexNumThreads = null, + bool? noEis = null, int? bootstrapTimeout = null, // index options string? indexNamePrefix = null, @@ -101,6 +103,8 @@ public async Task Index(IDiagnosticsCollector collector, cfg.SearchNumThreads = searchNumThreads.Value; if (indexNumThreads.HasValue) cfg.IndexNumThreads = indexNumThreads.Value; + if (noEis.HasValue) + cfg.NoElasticInferenceService = noEis.Value; if (!string.IsNullOrEmpty(indexNamePrefix)) cfg.IndexNamePrefix = indexNamePrefix; if (bufferSize.HasValue) diff --git a/src/services/Elastic.Documentation.Isolated/IsolatedIndexService.cs b/src/services/Elastic.Documentation.Isolated/IsolatedIndexService.cs index f26ba4092..3a60df236 100644 --- a/src/services/Elastic.Documentation.Isolated/IsolatedIndexService.cs +++ b/src/services/Elastic.Documentation.Isolated/IsolatedIndexService.cs @@ -33,6 +33,7 @@ ICoreService githubActionsService /// Index without semantic fields /// The number of search threads the inference endpoint should use. Defaults: 8 /// The number of index threads the inference endpoint should use. Defaults: 8 + /// Do not use the Elastic Inference Service, bootstrap inference endpoint /// Timeout in minutes for the inference endpoint creation. Defaults: 4 /// The prefix for the computed index/alias names. Defaults: semantic-docs /// Force reindex strategy to semantic index @@ -59,6 +60,7 @@ public async Task Index(IDiagnosticsCollector collector, bool? noSemantic = null, int? searchNumThreads = null, int? indexNumThreads = null, + bool? noEis = null, int? bootstrapTimeout = null, // index options string? indexNamePrefix = null, @@ -98,6 +100,8 @@ public async Task Index(IDiagnosticsCollector collector, cfg.SearchNumThreads = searchNumThreads.Value; if (indexNumThreads.HasValue) cfg.IndexNumThreads = indexNumThreads.Value; + if (noEis.HasValue) + cfg.NoElasticInferenceService = noEis.Value; if (!string.IsNullOrEmpty(indexNamePrefix)) cfg.IndexNamePrefix = indexNamePrefix; if (bufferSize.HasValue) diff --git a/src/tooling/docs-builder/Commands/Assembler/AssemblerIndexCommand.cs b/src/tooling/docs-builder/Commands/Assembler/AssemblerIndexCommand.cs index 2dfcc5c89..22bd5fb4b 100644 --- a/src/tooling/docs-builder/Commands/Assembler/AssemblerIndexCommand.cs +++ b/src/tooling/docs-builder/Commands/Assembler/AssemblerIndexCommand.cs @@ -33,6 +33,7 @@ ICoreService githubActionsService /// Index without semantic fields /// The number of search threads the inference endpoint should use. Defaults: 8 /// The number of index threads the inference endpoint should use. Defaults: 8 + /// Do not use the Elastic Inference Service, bootstrap inference endpoint /// The prefix for the computed index/alias names. Defaults: semantic-docs /// Force reindex strategy to semantic index /// Timeout in minutes for the inference endpoint creation. Defaults: 4 @@ -60,6 +61,7 @@ public async Task Index( bool? noSemantic = null, int? searchNumThreads = null, int? indexNumThreads = null, + bool? noEis = null, int? bootstrapTimeout = null, // index options @@ -93,7 +95,7 @@ public async Task Index( // endpoint options endpoint, environment, apiKey, username, password, // inference options - noSemantic, indexNumThreads, searchNumThreads, bootstrapTimeout, + noSemantic, indexNumThreads, searchNumThreads, noEis, bootstrapTimeout, // channel and connection options indexNamePrefix, forceReindex, bufferSize, maxRetries, debugMode, // proxy options @@ -106,7 +108,7 @@ static async (s, collector, state, ctx) => await s.Index(collector, state.fs, // endpoint options state.endpoint, state.environment, state.apiKey, state.username, state.password, // inference options - state.noSemantic, state.searchNumThreads, state.indexNumThreads, state.bootstrapTimeout, + state.noSemantic, state.searchNumThreads, state.indexNumThreads, state.noEis, state.bootstrapTimeout, // channel and connection options state.indexNamePrefix, state.forceReindex, state.bufferSize, state.maxRetries, state.debugMode, // proxy options diff --git a/src/tooling/docs-builder/Commands/IndexCommand.cs b/src/tooling/docs-builder/Commands/IndexCommand.cs index 48f2f1f3a..c6a38dcee 100644 --- a/src/tooling/docs-builder/Commands/IndexCommand.cs +++ b/src/tooling/docs-builder/Commands/IndexCommand.cs @@ -32,6 +32,7 @@ ICoreService githubActionsService /// The number of search threads the inference endpoint should use. Defaults: 8 /// The number of index threads the inference endpoint should use. Defaults: 8 /// The prefix for the computed index/alias names. Defaults: semantic-docs + /// Do not use the Elastic Inference Service, bootstrap inference endpoint /// Force reindex strategy to semantic index /// Timeout in minutes for the inference endpoint creation. Defaults: 4 /// The number of documents to send to ES as part of the bulk. Defaults: 100 @@ -58,6 +59,7 @@ public async Task Index( bool? noSemantic = null, int? searchNumThreads = null, int? indexNumThreads = null, + bool? noEis = null, int? bootstrapTimeout = null, // index options @@ -91,7 +93,7 @@ public async Task Index( // endpoint options endpoint, apiKey, username, password, // inference options - noSemantic, indexNumThreads, searchNumThreads, bootstrapTimeout, + noSemantic, indexNumThreads, noEis, searchNumThreads, bootstrapTimeout, // channel and connection options indexNamePrefix, forceReindex, bufferSize, maxRetries, debugMode, // proxy options @@ -104,7 +106,7 @@ static async (s, collector, state, ctx) => await s.Index(collector, state.fs, st // endpoint options state.endpoint, state.apiKey, state.username, state.password, // inference options - state.noSemantic, state.searchNumThreads, state.indexNumThreads, state.bootstrapTimeout, + state.noSemantic, state.searchNumThreads, state.indexNumThreads, state.noEis, state.bootstrapTimeout, // channel and connection options state.indexNamePrefix, state.forceReindex, state.bufferSize, state.maxRetries, state.debugMode, // proxy options