Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
});


Expand Down Expand Up @@ -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) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ ICoreService githubActionsService
/// <param name="noSemantic">Index without semantic fields</param>
/// <param name="searchNumThreads">The number of search threads the inference endpoint should use. Defaults: 8</param>
/// <param name="indexNumThreads">The number of index threads the inference endpoint should use. Defaults: 8</param>
/// <param name="noEis">Do not use the Elastic Inference Service, bootstrap inference endpoint</param>
/// <param name="bootstrapTimeout">Timeout in minutes for the inference endpoint creation. Defaults: 4</param>
/// <param name="indexNamePrefix">The prefix for the computed index/alias names. Defaults: semantic-docs</param>
/// <param name="forceReindex">Force reindex strategy to semantic index</param>
Expand All @@ -62,6 +63,7 @@ public async Task<bool> Index(IDiagnosticsCollector collector,
bool? noSemantic = null,
int? searchNumThreads = null,
int? indexNumThreads = null,
bool? noEis = null,
int? bootstrapTimeout = null,
// index options
string? indexNamePrefix = null,
Expand Down Expand Up @@ -101,6 +103,8 @@ public async Task<bool> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ ICoreService githubActionsService
/// <param name="noSemantic">Index without semantic fields</param>
/// <param name="searchNumThreads">The number of search threads the inference endpoint should use. Defaults: 8</param>
/// <param name="indexNumThreads">The number of index threads the inference endpoint should use. Defaults: 8</param>
/// <param name="noEis">Do not use the Elastic Inference Service, bootstrap inference endpoint</param>
/// <param name="bootstrapTimeout">Timeout in minutes for the inference endpoint creation. Defaults: 4</param>
/// <param name="indexNamePrefix">The prefix for the computed index/alias names. Defaults: semantic-docs</param>
/// <param name="forceReindex">Force reindex strategy to semantic index</param>
Expand All @@ -59,6 +60,7 @@ public async Task<bool> Index(IDiagnosticsCollector collector,
bool? noSemantic = null,
int? searchNumThreads = null,
int? indexNumThreads = null,
bool? noEis = null,
int? bootstrapTimeout = null,
// index options
string? indexNamePrefix = null,
Expand Down Expand Up @@ -98,6 +100,8 @@ public async Task<bool> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ ICoreService githubActionsService
/// <param name="noSemantic">Index without semantic fields</param>
/// <param name="searchNumThreads">The number of search threads the inference endpoint should use. Defaults: 8</param>
/// <param name="indexNumThreads">The number of index threads the inference endpoint should use. Defaults: 8</param>
/// <param name="noEis">Do not use the Elastic Inference Service, bootstrap inference endpoint</param>
/// <param name="indexNamePrefix">The prefix for the computed index/alias names. Defaults: semantic-docs</param>
/// <param name="forceReindex">Force reindex strategy to semantic index</param>
/// <param name="bootstrapTimeout">Timeout in minutes for the inference endpoint creation. Defaults: 4</param>
Expand Down Expand Up @@ -60,6 +61,7 @@ public async Task<int> Index(
bool? noSemantic = null,
int? searchNumThreads = null,
int? indexNumThreads = null,
bool? noEis = null,
int? bootstrapTimeout = null,

// index options
Expand Down Expand Up @@ -93,7 +95,7 @@ public async Task<int> 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
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/tooling/docs-builder/Commands/IndexCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ICoreService githubActionsService
/// <param name="searchNumThreads">The number of search threads the inference endpoint should use. Defaults: 8</param>
/// <param name="indexNumThreads">The number of index threads the inference endpoint should use. Defaults: 8</param>
/// <param name="indexNamePrefix">The prefix for the computed index/alias names. Defaults: semantic-docs</param>
/// <param name="noEis">Do not use the Elastic Inference Service, bootstrap inference endpoint</param>
/// <param name="forceReindex">Force reindex strategy to semantic index</param>
/// <param name="bootstrapTimeout">Timeout in minutes for the inference endpoint creation. Defaults: 4</param>
/// <param name="bufferSize">The number of documents to send to ES as part of the bulk. Defaults: 100</param>
Expand All @@ -58,6 +59,7 @@ public async Task<int> Index(
bool? noSemantic = null,
int? searchNumThreads = null,
int? indexNumThreads = null,
bool? noEis = null,
int? bootstrapTimeout = null,

// index options
Expand Down Expand Up @@ -91,7 +93,7 @@ public async Task<int> 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
Expand All @@ -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
Expand Down
Loading