Repair-Search.ps1 does not run for DevOps 2025
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
调研方向
从 ADO_Server_Diagnostics_2025/Troubleshooting/Repair-Search.ps1 开始,并验证其在 Troubleshooting/Utils 下对 Common.psm1 的依赖。然后检查 Analyzers/Test-IndicesHaveUnsupportedMappings.psm1,尤其是 Code 路径及其 mapping 请求,并在 Elasticsearch 8 上重现该失败。完成的标准是 Repair-Search 使用随附文件成功启动,并且 Code 的重新索引在没有报告的 mapping 错误的情况下完成。
由索引模型根据 Issue 内容生成。
描述
Our migration from Azure DevOps 2022 to 2025 is causing issues after the upgrade from Elasticsearch v7 to v8; the installation did not report any errors, but the Elastic instance was showing an error.
The logs indicated that some indices were still on v6, which is surprising as we were already using a version of DevOps that used Elasticsearch v7.
=> We therefore decided to perform a clean reinstallation and repair the Elasticsearch instance (by deleting the directory and running Repair-Search.ps1).
Unfortunately, the scripts in the ADO_Server_Diagnostics_2025 version appear to have some issues:
-
The recommended script, Troubleshooting\Repair-Search.ps1, crashes on launch because it depends on a module Common.psm1 that is not
present in the Utils directory (https://github.com/microsoft/Code-Search/blob/d4bad2abd67c5326d94bf8b00a94af1cd25b2954/ADO_Server_Diagnostics_2025/Troubleshooting/Repair-Search.ps1#L121)
To resolve this, we tried copying the version available in 2022; this works, but we cannot guarantee it. Could you please fix this issue? -
Re-indexing of the “Wiki” and “WorkItem” works without any problems; however, it does not work for the “Code” ItemType.
The script correctly identifies that the index is missing in Elasticsearch and attempts to create a mapping using the Test-IndicesHaveUnsupportedMappings method; Elasticsearch returns a 400.
Message: GET _mapping/SourceNoDedupeFileContract failed with status code [400] unexpectedly.
[2026-08-19T13:12:03Z][Verbose] Request Uri = [http://localhost:9200/code_sourcenodedupefilecontractv3_1421_shared_94814f29-47cc-46f9-b048-4caa32360ba3]
[2026-08-19T13:12:03Z][Verbose] Response = [{
"Content": null,
"ErrorMessage": "Invoke-WebRequest : Le serveur distant a retourné une erreur : (404) Introuvable.\r\nAu caractère C:\\temp\\Code-Search-master\\ADO_Server_Diagnostics_2025\\Troubleshooting\\Utils\\Common.psm1:236 : 25\r\n+ ... $response = Invoke-WebRequest -Method $Method -Uri $uri -Credential $ ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : InvalidOperation : (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebEx \r\n ception\r\n + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand\r\n \r\n",
"StatusCode": 404
}]
[2026-08-19T13:12:03Z][Error] Indexing index name in SQL [code_sourcenodedupefilecontractv3_1421_shared_94814f29-47cc-46f9-b048-4caa32360ba3] does not exist in Elasticsearch cluster at [http://localhost:9200/]. Re-indexing is required.
[2026-08-19T13:12:03Z][Warn] Actions recommended are [Restart-Indexing].
[2026-08-19T13:12:03Z][Info] ======================================================================================
[2026-08-19T13:12:03Z][Info] Executing analyzer [Test-IndicesHaveUnsupportedMappings]...
[2026-08-19T13:12:03Z][Verbose] ParentPath = [#\Service\ALMSearch\Settings\].
[2026-08-19T13:12:03Z][Verbose] ChildItem = [DefaultCodeDocumentContractType\].
[2026-08-19T13:12:03Z][Verbose] Supported document contract type for entity type [Code] = [SourceNoDedupeFileContractV3].
[2026-08-19T13:12:03Z][Verbose] Request Uri = [http://localhost:9200/_mapping/SourceNoDedupeFileContract]
[2026-08-19T13:12:03Z][Verbose] Response = [{
"Content": null,
"ErrorMessage": "Invoke-WebRequest : {\"error\":\"no handler found for uri [/_mapping/SourceNoDedupeFileContract] and method [GET]\"}\r\nAu caractère C:\\temp\\Code-Search-master\\ADO_Server_Diagnostics_2025\\Troubleshooting\\Utils\\Common.psm1:236 : 25\r\n+ ... $response = Invoke-WebRequest -Method $Method -Uri $uri -Credential $ ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : InvalidOperation : (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebEx \r\n ception\r\n + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand\r\n",
"StatusCode": 400
}]
[2026-08-19T13:12:03Z][Error] Repair-Search failed with following exception:
Message:
GET _mapping/SourceNoDedupeFileContract failed with status code [400] unexpectedly.
Au caractère C:\temp\Code-Search-master\ADO_Server_Diagnostics_2025\Troubleshooting\Analyzers\Test-IndicesHaveUnsupport
edMappings.psm1:78 : 13
+ throw "GET $command failed with status code [$($response. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (GET _mapping/So...] unexpectedly.:String) [], RuntimeException
+ FullyQualifiedErrorId : GET _mapping/SourceNoDedupeFileContract failed with status code [400] unexpectedly.
Stack Trace:
à Test-IndicesHaveUnsupportedMappings, C:\temp\Code-Search-master\ADO_Server_Diagnostics_2025\Troubleshooting\Analyzers\Test-IndicesHaveUnsupportedMappings.psm1 : ligne 78
à <ScriptBlock>, C:\temp\Code-Search-master\ADO_Server_Diagnostics_2025\Troubleshooting\Repair-Search.ps1 : ligne 155
à <ScriptBlock>, <Aucun fichier> : ligne 1
In the Test-IndicesHaveUnsupportedMappings analyser, there is a specific condition that applies only when the entityType is ‘Code’ and which will trigger a call to _mapping/SourceNoDedupeFileContract and _mapping/SourceNoDedupeFileContractV2
- 主要语言
- PowerShell
- 星标
- 57
- 派生
- 68
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/Code-Search 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 48/100
microsoft/Code-Search#123 ·
-
难度 5/5 一周以上 新手友好度 25/100
microsoft/Code-Search#98 · 2 条评论 · 2 个 reaction ·
-
难度 1/5 1 小时以内 新手友好度 15/100
microsoft/Code-Search#97 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
microsoft/Code-Search#96 ·
-
难度 2/5 1-3 小时 新手友好度 30/100
microsoft/Code-Search#95 · 1 条评论 ·
查看 microsoft/Code-Search 的全部 Issue
相似的 Issue
-
area:ai-suggestions bug P1
难度 2/5 1-3 小时 新手友好度 82/100
uttrflow/uttrflow-swift#3456 ·
维护者通常 1 天内回复
-
easy low
难度 2/5 1-3 小时 新手友好度 88/100
open-nudge/opentemplate#185 ·
维护者通常 1 天内回复
-
good-first-issue help-wanted security-slam
难度 2/5 1-3 小时 新手友好度 88/100
-
agent/quality hive/hosted-available-lke648397-260827-5n31 quality testing
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
security
难度 2/5 1-3 小时 新手友好度 62/100
IBM/ansible-lifecycle-driver#297 ·