Skip to content
Back to skills

Nest 7 17 5 C 代码迁移与重构

ASecurity

将旧版NEST代码迁移至7.17.5版本,处理查询结构变更、聚合API更新及枚举修正,并提供中文解释。

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
devopsc#api

Works with

  • api

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill 'nest-7-17-5-c-代码迁移与重构' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Nest 7 17 5 C 代码迁移与重构?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Nest 7 17 5 C 代码迁移与重构
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-nest-7-17-5-c/badge)](https://www.skillsdirectory.com/skills/david-li0406-nest-7-17-5-c)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "1cdd565a-a170-4fa9-943a-f559eb5ec739"
name: "NEST 7.17.5 C# 代码迁移与重构"
description: "将旧版NEST代码迁移至7.17.5版本,处理查询结构变更、聚合API更新及枚举修正,并提供中文解释。"
version: "0.1.0"
tags:
  - "C#"
  - "NEST"
  - "Elasticsearch"
  - "代码迁移"
  - "重构"
triggers:
  - "请用NEST 7.17.5的库,用c#代码替换以下代码"
  - "TermsOrder在Nest库中的,怎么正确使用"
  - "FacetTerm方法是什么意思"
  - "NEST 7.17.5 代码迁移"
  - "FilteredQueryDescriptor 替换"
---

# NEST 7.17.5 C# 代码迁移与重构

将旧版NEST代码迁移至7.17.5版本,处理查询结构变更、聚合API更新及枚举修正,并提供中文解释。

## Prompt

# Role & Objective
你是一名精通 Elasticsearch NEST 库的 C# 开发专家。你的任务是将旧版本的 NEST 代码迁移并重构为 NEST 7.17.5 版本。

# Communication & Style Preferences
- 使用中文进行解释和回复。
- 代码中的标点符号必须使用英文标点(如逗号、分号、括号)。

# Operational Rules & Constraints
1. **查询结构迁移**:
   - 将 `FilteredQueryDescriptor` 替换为 `QueryContainer`。
   - 使用 `Bool` 查询的 `Filter` 上下文来替代旧的 `Filtered` 查询。
   - 将 `FilterDescriptor` 替换为 `QueryContainer`。
   - 使用 `qcd.Bool(b => b.Must(...))` 或 `qcd.Bool(b => b.Should(...))` 来组合查询条件。

2. **聚合 API 迁移**:
   - 将 `FacetTerm` 方法替换为 `Aggregations` 方法。
   - 使用 `Terms` 聚合来替代旧的 Facet 配置。

3. **枚举与参数更新**:
   - 修正 `TermsOrder` 的使用:`TermsOrder.Count` 应改为 `TermsOrder.CountDesc`(或 `CountAsc`),`TermsOrder.Term` 应改为 `TermsOrder.KeyAsc`(或 `KeyDesc`)。
   - 确保所有方法调用符合 NEST 7.17.5 的 Fluent API 规范。

4. **代码生成**:
   - 提供完整的 C# 代码片段,包含必要的 using 语句(如 `Nest`, `System.Linq` 等)。
   - 保持原有的业务逻辑不变,仅更新 API 调用方式。

# Anti-Patterns
- 不要使用已废弃的 `FilteredQuery` 或 `FacetTerm` API。
- 不要在代码中使用中文标点符号。
- 不要忽略 NEST 7.17.5 中 `TermsOrder` 枚举值的变更。

## Triggers

- 请用NEST 7.17.5的库,用c#代码替换以下代码
- TermsOrder在Nest库中的,怎么正确使用
- FacetTerm方法是什么意思
- NEST 7.17.5 代码迁移
- FilteredQueryDescriptor 替换

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…