Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Elasticsearch connection string `scope` key has no effect on index names

Aperta
#2,696 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp, elasticsearch
Ambito
databases

Direzione di ricerca

Start with src/Exceptionless.Core/Configuration/ElasticsearchOptions.cs, especially ReadFromConfiguration and ParseConnectionString, then check src/Exceptionless.Core/Jobs/Elastic/DataMigrationJob.cs and the index configuration files named in the issue. Trace how Scope, ScopePrefix, and EnableSnapshotJobs are set for both Elasticsearch configurations. Done when the scope behavior matches the chosen expected outcome and index prefixes use consistent separators.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

ElasticsearchOptions parses a scope key from ConnectionStrings:Elasticsearch, but index names are built from ScopePrefix, which is computed from AppScope before the connection string is parsed. Setting scope= in the Elasticsearch connection string changes nothing.

Where

  • ElasticsearchOptions.ReadFromConfiguration sets Scope = appOptions.AppScope and ScopePrefix from it, then calls ParseConnectionString.
  • ParseConnectionString overwrites Scope from the scope key but never recomputes ScopePrefix.
  • Every index uses ScopePrefix, e.g. EventIndex and the migrations index. Nothing reads ElasticsearchOptions.Scope for the main cluster.
  • The only reader of Scope is DataMigrationJob, for ElasticsearchToMigrate, where it is used as a raw prefix with no - separator (scope=prod gives prodorganizations-v1, while the main cluster's prefix would be prod-).

Steps to reproduce

  1. Run with EX_ConnectionStrings__Elasticsearch=server=http://localhost:9200;scope=test and no EX_AppScope.
  2. List indexes: they are events-v1-*, stacks-v1, organizations-v1, etc., without a test- prefix.

Expected

Either scope in the Elasticsearch connection string prefixes index names the same way AppScope does, or the key is not parsed at all.

Suggested fix

Set ScopePrefix at the end of ParseConnectionString (ScopePrefix = String.IsNullOrEmpty(Scope) ? "" : $"{Scope}-"), so both the main and ElasticsearchToMigrate options get it, and compute the EnableSnapshotJobs default after parsing, since it depends on ScopePrefix. In DataMigrationJob, use ElasticsearchToMigrate.ScopePrefix so both sides use the same - separator. If per-connection scoping isn't wanted, remove the scope parsing for the main connection string and keep it only for ElasticsearchToMigrate.

Lingua principale
C#
Stelle
2.5k
Fork
508
Merge medio
2g 17h
PR unite (30g)
40

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di exceptionless/Exceptionless

Tutte le issue di exceptionless/Exceptionless

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.