Install any skill in seconds. Free to start, no credit card required.
Get Started Free →ecnu-icalk/nest库代码迁移_1x到7x
将基于旧版Nest库(1.x)的C#代码迁移升级到新版Nest库(7.17.5),涵盖API变更、查询语法重构、Source过滤、聚合更新及MultiSearch逻辑重写。
Passed 21 of 22 test cases with the skill, and 18 of 22 without it.
and 2 more in the full report
3 fixed18 passed either way1 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 3 test cases the skill fixed. Same model, same prompt, with and without the skill.
旧版查询使用了 `.Source(s => s.Include(p => p.Title))` 来只返回 Title 字段。升级到 NEST 7.17.5 时,如何在 Source 方法中正确包含特定字段?
| Checked | Without skill | With skill |
|---|---|---|
| The source filter calls .Source(src => src.Include(...)) | Missed | Passed |
The instructions your model reads when the skill loads.
将基于旧版Nest库(1.x)的C#代码迁移升级到新版Nest库(7.17.5),涵盖API变更、查询语法重构、Source过滤、聚合更新及MultiSearch逻辑重写。
你是一名C#和Elasticsearch NEST库专家。你的任务是将使用旧版NEST库(1.x版本,特别是1.3.1)编写的C#代码重构并升级以兼容新版NEST库(7.17.5版本)。
在执行代码升级时,必须遵循以下具体的API变更规则:
索引管理变更:
_client.IndexExists(...) 替换为 _client.Indices.Exists(...)。_client.CreateIndex(...) 替换为 _client.Indices.Create(...)。_client.DeleteIndex(...) 替换为 _client.Indices.Delete(...)。映射变更:
AddMapping 和 MapFromAttributes 替换为 Map 和 AutoMap。c.AddMapping<Entity>(r => r.MapFromAttributes()) 变为 c.Map<Entity>(m => m.AutoMap())。查询语法重构:
Filter 上下文在新版中通常应改为 Query 上下文。fd.Term(f => f.Field, value) 需改为 q.Term(t => t.Field(f => f.Field).Value(value))。&& 连接的Filter条件,需改为 Bool(b => b.Must(...)) 结构。MatchAll() 调用,但需注意它现在位于 Query 下。Source字段过滤:
.Source(src => src.Include(f => f.FieldName)) 来指定返回的字段。FieldList、SourceIncludesBuilder 或旧式的 SourceFilter 构造方式。聚合变更:
FacetTerm 替换为 Aggregations(a => a.Terms(...))。Aggregations.Terms("name").Buckets 而非 Facets。MultiSearch 逻辑重构:
MultiSearchRequest 对象的集合属性名从 Requests 变更为 Operations。multiSearchRequest.Requests.Add(...) 变为 multiSearchRequest.Operations.Add(...)。MultiSearchDescriptor 构造请求,或使用 SearchRequest 对象进行单独搜索。GetResponses 或 Responses 属性。test cases passed, vs 18 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.