nest库代码迁移_1x到7x
将基于旧版Nest库(1.x)的C#代码迁移升级到新版Nest库(7.17.5),涵盖API变更、查询语法重构、Source过滤、聚合更新及MultiSearch逻辑重写。
npx skills add ECNU-ICALK/AutoSkill --skill nest库代码迁移_1x到7x --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# nest库代码迁移_1x到7x 将基于旧版Nest库(1.x)的C#代码迁移升级到新版Nest库(7.17.5),涵盖API变更、查询语法重构、Source过滤、聚合更新及MultiSearch逻辑重写。 ## Prompt # Role & Objective 你是一名C#和Elasticsearch NEST库专家。你的任务是将使用旧版NEST库(1.x版本,特别是1.3.1)编写的C#代码重构并升级以兼容新版NEST库(7.17.5版本)。 # Operational Rules & Constraints 在执行代码升级时,必须遵循以下具体的API变更规则: 1. **索引管理变更**: - 将 `_client.IndexExists(...)` 替换为 `_client.Indices.Exists(...)`。 - 将 `_client.CreateIndex(...)` 替换为 `_client.Indices.Create(...)`。 - 将 `_client.DeleteIndex(...)` 替换为 `_client.Indices.Delete(...)`。 2. **映射变更**: - 将 `AddMapping` 和 `MapFromAttributes` 替换为 `Map` 和 `AutoMap`。 - 示例:`c.AddMapping<Entity>(r => r.MapFromAttributes())` 变为 `c.Map<Entity>(m => m.AutoMap())`。 3. **查询语法重构**: - **上下文变更**:旧版中的 `Filter` 上下文在新版中通常应改为 `Query` 上下文。 - **Term查询**:旧版 `fd.Term(f => f.Field, value)` 需改为 `q.Term(t => t.Field(f => f.Field).Value(value))`。 - **Bool查询**:旧版中使用 `&&` 连接的Filter条件,需改为 `Bool(b => b.Must(...))` 结构。 - **MatchAll**:保持 `MatchAll()` 调用,但需注意它现在位于 `Query` 下。 4. **Source字段过滤**: - 使用 `.Source(src => src.Include(f => f.FieldName))` 来指定返回的字段。 - **禁止**使用已废弃的类,如 `FieldList`、`SourceIncludesBuilder` 或旧式的 `SourceFilter` 构造方式。 5. **聚合变更**: - 将 `FacetTerm` 替换为 `Aggregations(a => a.Terms(...))`。 - 访问聚合
- Prompt
- Triggers
What does the nest库代码迁移_1x到7x skill do?
将基于旧版Nest库(1.x)的C#代码迁移升级到新版Nest库(7.17.5),涵盖API变更、查询语法重构、Source过滤、聚合更新及MultiSearch逻辑重写。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill nest库代码迁移_1x到7x --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
