gpt4 book ai didi

c# - 使用Vulcan Elasticsearch EPiServer映射错误

转载 作者:行者123 更新时间:2023-12-03 00:00:54 24 4
gpt4 key购买 nike

是否有人使用过名为Vulcan的EPiServer的elasticsearch客户端? (https://github.com/TCB-Internet-Solutions/vulcan)

通过所有帐户(包括写得很好的一个帐户:https://blog.wsol.com/getting-started-using-vulcan-search-in-episerver),它应该像从EPiServer NuGet feed中安装NuGet包“TcbInternetSolutions.Vulcan.Core”,添加web.config设置并运行计划作业一样简单。索引数据。

我在我的EPiServer项目(版本11.2.1)中安装了NuGet软件包(版本3.0.1),并设置了web.config设置,索引作业报告“作业已完成。请刷新页面以查看状态。”运行历史记录显示“Vulcan已成功在1个索引器中索引了100个项目!”。

但是,当我查看“\ App_Data \ EPiServerErrors.log”文件时,看到大量错误,例如:

ERROR TcbInternetSolutions.Vulcan.Core.Implementation.VulcanClient: Vulcan could not index content with content link 10 for language en: System.Exception: Invalid NEST response built from a unsuccessful low level call on PUT: /customername_en/EPiServer.Core.BlockData/10 Audit trail of this API call: - [1] BadResponse: Node: http://localhost:9200/ Took: 00:00:00.4026489 ServerError: ServerError: 400Type: mapper_parsing_exception Reason: "failed to find type parsed [string] for [contentAssetsID]" OriginalException: System.Net.WebException: The remote server returned an error: (400) Bad Request. at System.Net.HttpWebRequest.GetResponse() at Elasticsearch.Net.HttpConnection.Request[TReturn](RequestData requestData) in C:\Projects\elastic\net-2\src\Elasticsearch.Net\Connection\HttpConnection.cs:line 163



似乎由于在“[contentAssetsID]”为数字的情况下所有内容到字符串的默认映射,因此无法在索引“customername_en”中为类型“EPiServer.Core.BlockData”建立索引。因此,我尝试添加一个初始化类以将映射设置为AutoMap:
[ModuleDependency(typeof(ServiceContainerInitialization))]
public class SearchInitialization : IConfigurableModule
{
public void ConfigureContainer(ServiceConfigurationContext context)
{
// Nothing to do
}

public void Initialize(InitializationEngine context)
{
var vh = ServiceLocator.Current.GetInstance<VulcanHandler>();
var vhClient = vh.GetClient(new System.Globalization.CultureInfo("en"));
var res = vhClient.Map<EPiServer.Core.BlockData>(m => m.AutoMap());
}

public void Uninitialize(InitializationEngine context)
{
// Nothing to do
}
}

“res”返回成功的响应,但错误仍然发生。

此处出现完整错误: https://pastebin.com/T7NPgZj9

请帮忙!

最佳答案

感谢Dimitar,我使用的是ElasticSearch 5而不是2。更改为版本2后,它可以工作了。

关于c# - 使用Vulcan Elasticsearch EPiServer映射错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49169991/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com