Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#2,696 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
csharp, elasticsearch
领域
databases

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
C#
星标
2.5k
派生
508
平均合并
2 天 17 小时
30 天内合并 PR
40

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

exceptionless/Exceptionless 的其他 Issue

查看 exceptionless/Exceptionless 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。